-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.57 KB
/
Copy pathdotnet.yml
File metadata and controls
78 lines (66 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
# Get version from .cs file
- name: Get Version
run: |
version=$(grep 'public override string ModuleVersion =>' /home/runner/work/EntBossHP/EntBossHP/EntBossHP.cs | sed 's/.*=> "\(.*\)";/\1/')
version_under=${version// /_}
version_minus=${version// /-}
short_sha=$(echo $GITHUB_SHA | cut -c1-7)
tag=$(echo $version_minus | tr '[:upper:]' '[:lower:]')
file_ver=$(echo $version_under | tr '[:upper:]' '[:lower:]')
echo "VERSION=$version" >> $GITHUB_ENV
echo "VERSION_UNDER=$version_under" >> $GITHUB_ENV
echo "VERSION_MINUS=$version_minus" >> $GITHUB_ENV
echo "SHORT_SHA=$short_sha" >> $GITHUB_ENV
echo "TAG=$tag" >> $GITHUB_ENV
echo "FILE_VER=$file_ver" >> $GITHUB_ENV
# gather all file in for release
- name: Prepare Directory
run: |
# make main folder
mkdir -p release/addons/counterstrikesharp/plugins/
# Copy plugins folder
cp -r /home/runner/work/EntBossHP/EntBossHP/bin/Debug/net8.0/ release/addons/counterstrikesharp/plugins/
cp -r /home/runner/work/EntBossHP/EntBossHP/build/addons/counterstrikesharp/configs/ release/addons/counterstrikesharp/
cp -r /home/runner/work/EntBossHP/EntBossHP/build/cfg/ release/
# Change Directory
mv release/addons/counterstrikesharp/plugins/net8.0/ release/addons/counterstrikesharp/plugins/EntBossHP/
# artifact for user to getting a file.
- uses: actions/upload-artifact@v4
with:
name: EntBossHP-${{ env.SHORT_SHA }}
path: release/
# zip file
- name: Zip File
run: |
cd release
zip -r "EntBossHP_${{ env.FILE_VER }}.zip" addons cfg
- name: Create GitHub Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }}
name: ${{ env.VERSION }}
files: release/EntBossHP_${{ env.FILE_VER }}.zip