File tree Expand file tree Collapse file tree 1 file changed +29
-10
lines changed Expand file tree Collapse file tree 1 file changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -312,17 +312,36 @@ jobs:
312
312
commit_message : " [CI] badges update"
313
313
314
314
deploy-production :
315
- name : Deploy to production host
315
+ name : Deploy Godbolt production image
316
316
if : ${{ always() && github.ref == 'refs/heads/master' }}
317
317
needs : build-windows
318
- runs-on : ubuntu-latest
318
+ runs-on : windows-2022
319
319
320
320
steps :
321
- - name : Pull latest images, re-run containers
322
- uses : appleboy/ssh-action@v1
323
- with :
324
- host : ${{ secrets.CE_HOST }}
325
- username : ${{ secrets.CE_USER }}
326
- key : ${{ secrets.CE_KEY }}
327
- script : |
328
- powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -NoExit -File C:\Scripts\startup-docker.ps1
321
+ - name : Invoke Web Request
322
+ run : |
323
+ function Invoke-UpdateImages {
324
+ param(
325
+ [string]$Token,
326
+ [string]$Url = 'https://godbolt.devsh.eu/api/update-images'
327
+ )
328
+
329
+ $resp = Invoke-WebRequest -Method Post `
330
+ -Uri $Url `
331
+ -Headers @{ 'X-API-Token' = $Token } `
332
+ -SkipHttpErrorCheck
333
+
334
+ $httpCode = $resp.StatusCode
335
+ $body = $resp.Content | ConvertFrom-Json
336
+
337
+ Write-Host "HTTP code : $httpCode"
338
+ Write-Host "status : $($body.status)"
339
+ Write-Host "message : $($body.message)"
340
+
341
+ if ($httpCode -ne 200) {
342
+ throw "Request failed"
343
+ }
344
+ }
345
+
346
+ $token = '${{ secrets.CE_IMAGE_UPDATE_TOKEN }}'
347
+ Invoke-UpdateImages -Token $token
You can’t perform that action at this time.
0 commit comments