From 1bd304f68c8f3399bb3ddc31500eed5a6f410409 Mon Sep 17 00:00:00 2001 From: Marek Rusinowski Date: Sun, 17 Mar 2024 16:27:41 +0100 Subject: [PATCH] Add GitHub workflow to push changes to players quicker --- .github/workflows/quick_deploy.yml | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/quick_deploy.yml diff --git a/.github/workflows/quick_deploy.yml b/.github/workflows/quick_deploy.yml new file mode 100644 index 000000000..1affaf9ce --- /dev/null +++ b/.github/workflows/quick_deploy.yml @@ -0,0 +1,35 @@ +# Workflow to push the change to deploy the change to players +# on push to master much quicker without waiting for cron jobs. +name: Deploy +on: + push: + branches: + - master +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger rebuild + run: | + echo "$SSH_KEY" > id.key + chmod og-rwx id.key + ssh -i id.key -o StrictHostKeyChecking=no debian@repos.beyondallreason.dev byar-chobby + env: + SSH_KEY: ${{ secrets.SSH_REPOS_DEPLOY_KEY }} + - name: Authenticate to Google Cloud + id: auth + uses: google-github-actions/auth@v2 + with: + workload_identity_provider: projects/640511349987/locations/global/workloadIdentityPools/github-actions/providers/github + service_account: github-actions@bar-rapid-syncer-176212.iam.gserviceaccount.com + token_format: id_token + id_token_audience: cdnupdater + id_token_include_email: true + - name: Sync files to CDN + run: | + curl --fail -H "Authorization: Bearer ${{ steps.auth.outputs.id_token }}" \ + -X POST -d '["byar-chobby"]' https://rapidsyncer-ssd-7xiouooxaa-ey.a.run.app/sync + - name: Update CDN pointer + run: | + curl --fail -H "Authorization: Bearer ${{ steps.auth.outputs.id_token }}" \ + -X GET https://bunny-update-edge-rule-7xiouooxaa-ew.a.run.app/update-edge-rule.sh