From c1422ca8ec8b1a7e17e1a18a27684af1ae12669f Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Sat, 24 Aug 2024 12:53:09 -0400 Subject: [PATCH] [ci] Invalidate GCP CDN Cache on successful master builds --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2ec677f..cc8cedf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,3 +60,23 @@ jobs: env: SRC_URL: /home/runner/work/openwisp-docs/openwisp-docs/_build/docs/ DST_URL: gs://${{ secrets.GCS_DOCS_BUCKET_NAME }}/docs/ + + invalidate-cache: + runs-on: ubuntu-latest + needs: build + if: ${{ needs.build.result == 'success' }} && ${{ github.event_name=='push' }} + + steps: + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCS_DOWNLOADS_SERVICE_ACCOUNT_JSON }} + project_id: ${{ secrets.GCS_PROJECT_ID }} + export_environment_variables: true + + - name: Invalid CDN cache on GCP + uses: stefanodotit/github-actions-invalidate-gcp-cdn@v1 + with: + load_balancer_name: ${{ secrets.GCS_MAIN_LOAD_BALANCER_NAME }} + host: openwisp.io + path: '/docs/*'