From 6114ff26915d6928589080e92deac7fde07c2334 Mon Sep 17 00:00:00 2001 From: Ricardo Pinto Date: Mon, 26 May 2025 15:33:18 +0100 Subject: [PATCH] Fixed destroy tests staging databases when a PR is merged ref no-issue - Fixed destroy staging databases when a PR is merged --- .github/workflows/cicd.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 85ee8720f..b649f2c5d 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -308,6 +308,24 @@ jobs: - region: europe-west3 region_name: frankfurt steps: + - name: "Authenticate with GCP (staging envs)" + if: ${{ matrix.region == 'europe-west4' }} + uses: google-github-actions/auth@v2 + with: + token_format: access_token + workload_identity_provider: projects/687476608778/locations/global/workloadIdentityPools/github-oidc-activitypub/providers/github-provider-activitypub + service_account: stg-activitypub-cicd-stg-envs@ghost-activitypub.iam.gserviceaccount.com + + - name: "Destroy Tests databases" + if: ${{ matrix.region == 'europe-west4' }} + env: + GCP_PROJECT: ghost-activitypub + run: | + TEST_DATABASES=$(gcloud sql databases list --instance=stg-netherlands-activitypub --filter="name~test*" --format="value(name)" --project ${GCP_PROJECT}) + for TEST_DATABASE in ${TEST_DATABASES}; do + gcloud sql databases delete ${TEST_DATABASE} --instance=stg-netherlands-activitypub --quiet --project ${GCP_PROJECT} + done + - name: "Authenticate with GCP" id: gcp-auth uses: google-github-actions/auth@v2 @@ -340,16 +358,6 @@ jobs: # labels: |- # commit-sha=${{ github.sha }} - - name: "Destroy Tests databases" - if: ${{ matrix.region == 'europe-west4' }} - env: - GCP_PROJECT: ghost-activitypub - run: | - TEST_DATABASES=$(gcloud sql databases list --instance=stg-netherlands-activitypub --filter="name~test*" --format="value(name)" --project ${GCP_PROJECT}) - for TEST_DATABASE in ${TEST_DATABASES}; do - gcloud sql databases delete ${TEST_DATABASE} --instance=stg-netherlands-activitypub --quiet --project ${GCP_PROJECT} - done - - name: "Deploy ActivityPub Queue to Cloud Run" uses: google-github-actions/deploy-cloudrun@v2 with: