11name : CI
22
3- on : [push, pull_request]
3+ on :
4+ pull_request :
5+ push : {}
6+ release :
7+ types : [published]
48
59env :
610 GMODNET_VERSION : ' 0.6.0'
1317
1418 steps :
1519 - name : Checkout
16- uses : actions/checkout@v2
20+ uses : actions/checkout@v2.3.4
1721 with :
1822 submodules : ' true'
1923
@@ -82,19 +86,19 @@ jobs:
8286# Finilize nightly build for push event
8387
8488 - name : Download GMS
85- if : github.event_name == 'push'
89+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
8690 run : |
8791 wget https://github.com/GlebChili/GmodNetModuleSigner/releases/download/1.0.0/gms
8892 chmod +x gms
8993
9094 - name : Download signature key
91- if : github.event_name == 'push'
95+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
9296 env :
9397 GITHUB_TOKEN : ${{ secrets.GMOD_NET_PRIVATE_KEY_REPO_TOKEN }}
9498 run :
git clone https://GlebChili:[email protected] /GlebChili/GmodDotNetPrivateKey.git 9599
96100 - name : Sign assemblies
97- if : github.event_name == 'push'
101+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
98102 run : |
99103 cd build
100104 ./../gms --sign=gmcl_dotnet_linux64.dll --key=../GmodDotNetPrivateKey/gmodnet-private.modulekey --version=$GMODNET_VERSION
@@ -108,19 +112,19 @@ jobs:
108112 mv gmodnet-public.modulekey GmodNET.modulekey
109113
110114 - name : Pack build
111- if : github.event_name == 'push'
115+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
112116 env :
113117 TRAVIS_COMMIT : ${{ github.sha }}
114118 run : |
115119 cd build
116120 tar czfv ../linux-$TRAVIS_COMMIT.tar.gz .
117121
118122 - name : Pack with MSBuild
119- if : github.event_name == 'push'
123+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
120124 run : dotnet build runtime.csproj -target:PackRuntimeBuild
121125
122126 - name : Upload versioned build as artifact
123- if : github.event_name == 'push'
127+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
124128125129 with :
126130 name : linux-versioned-build
@@ -132,7 +136,7 @@ jobs:
132136
133137 steps :
134138 - name : Checkout
135- uses : actions/checkout@v2
139+ uses : actions/checkout@v2.3.4
136140 with :
137141 submodules : ' true'
138142
@@ -165,12 +169,20 @@ jobs:
165169 cp lua/Tests/run_tests.lua gmod/garrysmod/lua/autorun
166170
167171 - name : Run Garry's Mod
168- shell : bash
172+ shell : pwsh
169173 run : |
170- powershell -Command ' ./gmod/srcds_win64.exe -console -systemtest -condebug -game "garrysmod" +exec "server.cfg" +gamemode sandbox +map gm_construct +maxplayers 16 +sv_hibernate_think 1'
171- powershell -Command ' Wait-Process -Name srcds_win64'
174+ ./gmod/srcds_win64.exe -console -systemtest -condebug -game "garrysmod" +exec "server.cfg" +gamemode sandbox +map gm_construct +maxplayers 16 +sv_hibernate_think 1
175+ Wait-Process -Name srcds_win64
172176 timeout-minutes : 5
173177 continue-on-error : true
178+ env :
179+ COREHOST_TRACE : 1
180+ COREHOST_TRACE_VERBOSITY : 4
181+ COREHOST_TRACEFILE : corehost_trace.txt
182+
183+ - name : Print Corehost trace
184+ working-directory : ./gmod/
185+ run : cat corehost_trace.txt
174186
175187 - name : Print console log
176188 run : cat gmod/garrysmod/console.log
@@ -192,19 +204,19 @@ jobs:
192204 # Finilize full signed build on push
193205
194206 - name : Download GMS
195- if : github.event_name == 'push'
207+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
196208 shell : bash
197209 run : curl -O -L https://github.com/GlebChili/GmodNetModuleSigner/releases/download/1.0.0/gms.exe
198210
199211 - name : Download signature key
200- if : github.event_name == 'push'
212+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
201213 shell : bash
202214 env :
203215 GITHUB_TOKEN : ${{ secrets.GMOD_NET_PRIVATE_KEY_REPO_TOKEN }}
204216 run :
git clone https://GlebChili:[email protected] /GlebChili/GmodDotNetPrivateKey.git 205217
206218 - name : Sign assemblies
207- if : github.event_name == 'push'
219+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
208220 shell : bash
209221 run : |
210222 cd build
@@ -219,11 +231,11 @@ jobs:
219231 mv gmodnet-public.modulekey GmodNET.modulekey
220232
221233 - name : Pack with MSBuild
222- if : github.event_name == 'push'
234+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
223235 run : dotnet build runtime.csproj -target:PackRuntimeBuild
224236
225237 - name : Upload versioned build as artifact
226- if : github.event_name == 'push'
238+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
227239228240 with :
229241 name : windows-versioned-build
@@ -236,7 +248,7 @@ jobs:
236248 steps :
237249
238250 - name : Checkout
239- uses : actions/checkout@v2
251+ uses : actions/checkout@v2.3.4
240252 with :
241253 submodules : ' true'
242254
@@ -257,19 +269,19 @@ jobs:
257269# Finilize full signed build on push
258270
259271 - name : Download GMS
260- if : github.event_name == 'push'
272+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
261273 run : |
262274 curl -O -L https://github.com/GlebChili/GmodNetModuleSigner/releases/download/1.0.0/gms-osx
263275 chmod +x gms-osx
264276
265277 - name : Download signature key
266- if : github.event_name == 'push'
278+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
267279 env :
268280 GITHUB_TOKEN : ${{ secrets.GMOD_NET_PRIVATE_KEY_REPO_TOKEN }}
269281 run :
git clone https://GlebChili:[email protected] /GlebChili/GmodDotNetPrivateKey.git 270282
271283 - name : Sign assemblies
272- if : github.event_name == 'push'
284+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
273285 run : |
274286 cd build
275287 ./../gms-osx --sign=gmcl_dotnet_osx64.dll --key=../GmodDotNetPrivateKey/gmodnet-private.modulekey --version=$GMODNET_VERSION
@@ -283,11 +295,11 @@ jobs:
283295 mv gmodnet-public.modulekey GmodNET.modulekey
284296
285297 - name : Pack with MSBuild
286- if : github.event_name == 'push'
298+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
287299 run : dotnet build runtime.csproj -target:PackRuntimeBuild
288300
289301 - name : Upload versioned build as artifact
290- if : github.event_name == 'push'
302+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
291303292304 with :
293305 name : osx-versioned-build
@@ -299,12 +311,12 @@ jobs:
299311
300312 needs : [linux-build, windows-build, mac-build]
301313
302- if : github.event_name == 'push'
314+ if : ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
303315
304316 steps :
305317
306318 - name : Checkout repository
307- uses : actions/checkout@v2
319+ uses : actions/checkout@v2.3.4
308320 with :
309321 submodules : ' true'
310322
@@ -359,11 +371,25 @@ jobs:
359371 SOURCE_DIR : ' versioned-publish'
360372 DEST_DIR : ' GmodNETStorage/storage'
361373
362- - name : Upload API nuget package
374+ - name : Upload API nuget package to Azure DevOps
363375 run : |
364- dotnet nuget update source gmodnet-packages --username CI --password ${{ secrets.DEVOPS_PASSWORD }} --store-password-in-clear-text
376+ dotnet nuget update source gmodnet-packages --username CI --password ${{ secrets.AZURE_DEVOPS_ARTIFACTS_PAT }} --store-password-in-clear-text
365377 dotnet nuget push nuget-publish/**.nupkg --source gmodnet-packages --api-key az --skip-duplicate
366378
379+ - name : Upload NuGet package to NuGet.org
380+ if : ${{ github.event_name == 'release' }}
381+ run : dotnet nuget push nuget-publish/**.nupkg --source nuget --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
382+
383+ - name : Upload build to GitHub release
384+ if : ${{ github.event_name == 'release' }}
385+ 386+ with :
387+ repo_token : ${{ secrets.GITHUB_TOKEN }}
388+ file : versioned-publish/*
389+ overwrite : true
390+ tag : ${{ github.ref }}
391+ file_glob : true
392+
367393 - name : Restore local dotnet tools
368394 run : |
369395 cd csx
0 commit comments