-
-
Notifications
You must be signed in to change notification settings - Fork 10
258 lines (223 loc) · 11 KB
/
builder.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: "Swiftly Compiler"
on:
push:
branches:
- '**'
pull_request:
jobs:
versioning:
permissions:
contents: write
runs-on: ubuntu-latest
container:
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Packages
shell: bash
run: |
sudo apt update
sudo apt install -y curl jq
- name: Generate version
uses: reecetech/[email protected]
id: version
with:
release_branch: master
increment: patch
use_api: true
extensions_build:
name: Extension Build
needs: versioning
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
extension: [mysql-extension,console-filter,addons-extension,http-extension,ip-extension,utils-extension]
include:
- os: ubuntu-latest
container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk
steps:
- name: Checkout Extension
uses: actions/checkout@v4
with:
repository: swiftly-solution/${{ matrix.extension }}
path: ${{ matrix.extension }}
submodules: recursive
- name: Checkout AMBuild
uses: actions/checkout@v4
with:
repository: alliedmodders/ambuild
path: ambuild
- name: Install AMBuild
run: |
cd ambuild; python setup.py install; cd ..
- name: Version
shell: bash
run: echo "VERSION=${{needs.versioning.outputs.version}}" >> $GITHUB_ENV
- name: Build - Linux
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ matrix.extension }}
shell: bash
run: |
sudo apt update
sudo apt install -y libreadline-dev libboost-all-dev
bash ./setup.sh
- name: Build - Windows
if: matrix.os == 'windows-latest'
working-directory: ${{ matrix.extension }}
run: |
./setup.ps1
- name: IP EXT - Linux
if: ${{ matrix.os == 'ubuntu-latest' && matrix.extension == 'ip-extension' }}
working-directory: ${{ matrix.extension }}
shell: bash
run: |
wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -O build/package/addons/swiftly/data/GeoLite2-City.mmdb
wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb -O build/package/addons/swiftly/data/GeoLite2-ASN.mmdb
- name: IP EXT - Windows
if: ${{ matrix.os == 'windows-latest' && matrix.extension == 'ip-extension' }}
working-directory: ${{ matrix.extension }}
run: |
Set-Location build/package/addons/swiftly
Invoke-WebRequest https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -OutFile data/GeoLite2-City.mmdb
Invoke-WebRequest https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb -OutFile data/GeoLite2-ASN.mmdb
Set-Location ../../../..
- name: Upload Artifacts Linux
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ${{matrix.extension}}.Extension.Linux
path: ${{ github.workspace }}/${{ matrix.extension }}/build/package
- name: Upload Artifacts Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ${{matrix.extension}}.Extension.Windows
path: ${{ github.workspace }}/${{ matrix.extension }}/build/package
build:
name: Build
needs: versioning
runs-on: ${{ matrix.os }}
env:
MMSOURCE20: ${{ github.workspace }}/swiftly/alliedmodders/metamod
HL2SDKCS2: ${{ github.workspace }}/swiftly/alliedmodders/hl2sdk
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: swiftly
submodules: recursive
- name: Checkout AMBuild
uses: actions/checkout@v4
with:
repository: alliedmodders/ambuild
path: ambuild
- name: Install AMBuild
run: |
cd ambuild; python setup.py install; cd ..
- name: Setup Version
shell: bash
run: echo "SWIFTLY_VERSION=${{needs.versioning.outputs.version}}" >> $GITHUB_ENV
- name: Build - Linux
if: matrix.os == 'ubuntu-latest'
working-directory: swiftly
shell: bash
run: |
sudo apt update
sudo apt install -y libreadline-dev libboost-all-dev unzip
bash ./setup.sh
echo "[Builder] Setting up default plugins"
cp -r build/package build/package2
cd build/package/addons/swiftly
wget https://github.com/swiftly-solution/admins/releases/latest/download/Swiftly.Plugin.Admins.zip
unzip Swiftly.Plugin.Admins.zip
wget https://github.com/swiftly-solution/admins_basecomms/releases/latest/download/Swiftly.Plugin.Admins.BaseComms.zip
unzip Swiftly.Plugin.Admins.BaseComms.zip
wget https://github.com/swiftly-solution/admins_basebans/releases/latest/download/Swiftly.Plugin.Admins.BaseBans.zip
unzip Swiftly.Plugin.Admins.BaseBans.zip
wget https://github.com/swiftly-solution/admins_commands/releases/latest/download/Swiftly.Plugin.Admins.BaseCommands.zip
unzip Swiftly.Plugin.Admins.BaseCommands.zip
wget https://github.com/swiftly-solution/cookies/releases/latest/download/cookies.zip
unzip cookies.zip
rm -rf Swiftly.Plugin.Admins.zip
rm -rf Swiftly.Plugin.Admins.BaseComms.zip
rm -rf Swiftly.Plugin.Admins.BaseBans.zip
rm -rf Swiftly.Plugin.Admins.BaseCommands.zip
rm -rf cookies.zip
cd ../../../..
echo "[Builder] Finished setting up default plugins"
- name: Build - Windows
if: matrix.os == 'windows-latest'
working-directory: swiftly
run: |
./setup.ps1
Set-Location build/package/addons/swiftly
Invoke-WebRequest https://github.com/swiftly-solution/admins/releases/latest/download/Swiftly.Plugin.Admins.zip -OutFile Swiftly.Plugin.Admins.zip
Expand-Archive Swiftly.Plugin.Admins.zip -DestinationPath .
Invoke-WebRequest https://github.com/swiftly-solution/admins_basecomms/releases/latest/download/Swiftly.Plugin.Admins.BaseComms.zip -OutFile Swiftly.Plugin.Admins.BaseComms.zip
Expand-Archive Swiftly.Plugin.Admins.BaseComms.zip -DestinationPath .
Invoke-WebRequest https://github.com/swiftly-solution/admins_basebans/releases/latest/download/Swiftly.Plugin.Admins.BaseBans.zip -OutFile Swiftly.Plugin.Admins.BaseBans.zip
Expand-Archive Swiftly.Plugin.Admins.BaseBans.zip -DestinationPath .
Invoke-WebRequest https://github.com/swiftly-solution/admins_commands/releases/latest/download/Swiftly.Plugin.Admins.BaseCommands.zip -OutFile Swiftly.Plugin.Admins.BaseCommands.zip
Expand-Archive Swiftly.Plugin.Admins.BaseCommands.zip -DestinationPath .
Invoke-WebRequest https://github.com/swiftly-solution/cookies/releases/latest/download/cookies.zip -OutFile cookies.zip
Expand-Archive cookies.zip -DestinationPath .
Remove-Item -Force Swiftly.Plugin.Admins.zip
Remove-Item -Force Swiftly.Plugin.Admins.BaseComms.zip
Remove-Item -Force Swiftly.Plugin.Admins.BaseBans.zip
Remove-Item -Force Swiftly.Plugin.Admins.BaseCommands.zip
Remove-Item -Force cookies.zip
Set-Location ../../../..
- name: Upload Artifacts Linux
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: Swiftly.Plugin.Linux
path: ${{ github.workspace }}/swiftly/build/package
- name: Upload Artifacts Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: Swiftly.Plugin.Windows
path: ${{ github.workspace }}/swiftly/build/package
release:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
permissions:
contents: write
needs: ["versioning", "build", "extensions_build"]
runs-on: ubuntu-latest
container:
image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk
steps:
- uses: actions/download-artifact@v4
id: download-artifacts
with:
path: build
- name: Prepare ZIP Files
run: |
sudo apt install p7zip-full -y;
find build -type d -name "*Extension.Linux" -exec cp -r {}/addons build/Swiftly.Plugin.Linux \;
find build -type d -name "*Extension.Windows" -exec cp -r {}/addons build/Swiftly.Plugin.Windows \;
(cd build/Swiftly.Plugin.Linux; 7z a -tzip ../../../Swiftly.Plugin.Linux.zip *)
(cd build/Swiftly.Plugin.Windows; 7z a -tzip ../../../Swiftly.Plugin.Windows.zip *)
echo "PATH_ARTIFACTS=$(cd ..; pwd)" >> $GITHUB_ENV
- name: Release
id: release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.versioning.outputs.version }}
make_latest: "true"
files: |
${{env.PATH_ARTIFACTS}}/Swiftly.Plugin.Linux.zip
${{env.PATH_ARTIFACTS}}/Swiftly.Plugin.Windows.zip