-
Notifications
You must be signed in to change notification settings - Fork 10
157 lines (132 loc) · 8.18 KB
/
build.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# 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" ]
env:
VERSION: ""
VERSION_UNDER: ""
VERSION_MINUS: ""
TAG: ""
FILE_VER: ""
SHORT_SHA: ""
jobs:
build:
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
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Get Plugins Version
run: |
version=$(grep 'public override string ModuleVersion =>' /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/ZombieSharp.cs | sed 's/.*=> "\(.*\)";/\1/')
version_under=${version// /_}
version_minus=${version// /-}
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 "TAG=$tag" >> $GITHUB_ENV
echo "FILE_VER=$file_ver" >> $GITHUB_ENV
- name: Get Commit ID
run: |
short_sha=$(echo $GITHUB_SHA | cut -c1-7)
echo "SHORT_SHA=$short_sha" >> $GITHUB_ENV
- name: Prepare main plugin
run: |
mkdir -p release/addons/counterstrikesharp/plugins/ZombieSharp
# Copy all plugins file
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/Dapper.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/Google.Protobuf.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/IZombieSharpAPI.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/IZombieSharpAPI.pdb release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/Microsoft.Data.Sqlite.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/MySql.Data.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/Newtonsoft.Json.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/SQLitePCLRaw.batteries_v2.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/SQLitePCLRaw.core.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/SQLitePCLRaw.provider.e_sqlite3.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.Configuration.ConfigurationManager.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.Diagnostics.EventLog.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.IO.Pipelines.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.Security.Cryptography.ProtectedData.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.Security.Permissions.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/System.Windows.Extensions.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/ZombieSharp.dll release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/ZombieSharp.pdb release/addons/counterstrikesharp/plugins/ZombieSharp/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/plugins/ZombieSharp/lang/ release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/plugins/ZombieSharp/hitgroups.json release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/plugins/ZombieSharp/playerclasses.json release/addons/counterstrikesharp/plugins/ZombieSharp/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/plugins/ZombieSharp/weapons.json release/addons/counterstrikesharp/plugins/ZombieSharp/
# make SQLite dependencies folder.
mkdir -p release/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/8.0.3
# copy sqlite dependencies files.
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/runtimes/linux-x64/native/libe_sqlite3.so release/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/8.0.3/
cp /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/bin/Debug/net8.0/runtimes/win-x64/native/e_sqlite3.dll release/addons/counterstrikesharp/dotnet/shared/Microsoft.NETCore.App/8.0.3/
- name: Prepare API folder
run: |
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharpAPI/bin/Debug/net8.0/ release/addons/counterstrikesharp/
mv release/addons/counterstrikesharp/net8.0 release/addons/counterstrikesharp/shared
- name: Prepare other file
run: |
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/cfg/ release/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/characters/ release/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/soundevents/ release/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/sounds/ release/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/gamedata/ release/addons/counterstrikesharp/
cp -r /home/runner/work/ZombieSharp/ZombieSharp/ZombieSharp/build/addons/counterstrikesharp/configs/ release/addons/counterstrikesharp/
- uses: actions/upload-artifact@v4
with:
name: ZombieSharp-build-${{ env.SHORT_SHA }}
path: release/
- name: Check Ref
run: |
echo "Event: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: "build"
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Get Commit ID
run: |
short_sha=$(echo $GITHUB_SHA | cut -c1-7)
echo "SHORT_SHA=$short_sha" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
name: ZombieSharp-build-${{ env.SHORT_SHA }}
path: release/
- name: Zip File
run: |
cd release/
zip -r "zsharp_stable_${{ env.FILE_VER }}.zip"
- name: Tag Check
uses: mukunku/[email protected]
id: check-tag
with:
tag: stable-${{ env.TAG }}
- name: Change Tag
if: steps.check-tag.outputs.exists == 'true'
run: |
echo "VERSION=${{ env.VERSION }} Hotfix" >> $GITHUB_ENV
cho "TAG=${{ env.TAG }}-hotfix" >> $GITHUB_ENV
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: stable-${{ env.TAG }}
name: Stable ${{ env.VERSION }}
files: release/zsharp_stable_${{ env.FILE_VER }}.zip