From 420eb0141929e238856ef35642710496416cfef7 Mon Sep 17 00:00:00 2001 From: Adam Richie-Halford Date: Mon, 3 Jun 2024 15:51:42 -0700 Subject: [PATCH] WIP: Make all GitHub action workflows conditional --- .github/workflows/cypress-network-tests.yml | 3 ++- .github/workflows/cypress-participant-tests.yml | 1 + .github/workflows/cypress-partner-admin-tests.yml | 1 + .../workflows/deploy-firestore-rules-indexes-dev.yml | 12 ++++++++---- .../deploy-firestore-rules-indexes-production.yml | 12 ++++++++---- .github/workflows/firebase-hosting-preview.yml | 6 +++--- .github/workflows/firebase-hosting-production.yml | 6 ++++-- .github/workflows/firebase-hosting-staging.yml | 5 +++-- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cypress-network-tests.yml b/.github/workflows/cypress-network-tests.yml index dddc5480a..029a9fca4 100644 --- a/.github/workflows/cypress-network-tests.yml +++ b/.github/workflows/cypress-network-tests.yml @@ -11,6 +11,7 @@ concurrency: jobs: cypress-run: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Run Cypress Network Tests runs-on: ubuntu-latest timeout-minutes: 90 @@ -20,7 +21,7 @@ jobs: browser: [chromium, edge] containers: [1, 2] env: - CYPRESS_BASE_URL: ${{ secrets.ROAR_PRODUCTION_URL }} + CYPRESS_BASE_URL: ${{ secrets.PRODUCTION_URL }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} COMMIT_INFO_MESSAGE: Network Tests for Release ${{ github.event.release.tag_name }} "${{ github.event.release.name }}:" "${{ github.event.release.body }}" COMMIT_INFO_SHA: ${{ github.event.release.release_id }} diff --git a/.github/workflows/cypress-participant-tests.yml b/.github/workflows/cypress-participant-tests.yml index 12b85f993..e98292c08 100644 --- a/.github/workflows/cypress-participant-tests.yml +++ b/.github/workflows/cypress-participant-tests.yml @@ -9,6 +9,7 @@ concurrency: jobs: cypress-run: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Run Cypress Participant Tests runs-on: ubuntu-latest timeout-minutes: 90 diff --git a/.github/workflows/cypress-partner-admin-tests.yml b/.github/workflows/cypress-partner-admin-tests.yml index aea727d4e..20dfd7f70 100644 --- a/.github/workflows/cypress-partner-admin-tests.yml +++ b/.github/workflows/cypress-partner-admin-tests.yml @@ -9,6 +9,7 @@ concurrency: jobs: cypress-run: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Run Cypress Partner Admin Tests runs-on: ubuntu-latest timeout-minutes: 90 diff --git a/.github/workflows/deploy-firestore-rules-indexes-dev.yml b/.github/workflows/deploy-firestore-rules-indexes-dev.yml index 0e9afa3bc..761a1df70 100644 --- a/.github/workflows/deploy-firestore-rules-indexes-dev.yml +++ b/.github/workflows/deploy-firestore-rules-indexes-dev.yml @@ -6,6 +6,7 @@ name: Deploy Firestore Rules and Indexes (Development) jobs: deploy-admin-rules: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Admin Rules runs-on: ubuntu-latest steps: @@ -16,10 +17,11 @@ jobs: with: args: deploy --only firestore:rules env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN_DEV }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ADMIN_DEV }} PROJECT_ID: gse-roar-admin-dev PROJECT_PATH: ./firebase/admin deploy-assessment-rules: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Assessment Rules runs-on: ubuntu-latest steps: @@ -30,10 +32,11 @@ jobs: with: args: deploy --only firestore:rules env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ASSESSMENT_DEV }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ASSESSMENT_DEV }} PROJECT_ID: gse-roar-assessment-dev PROJECT_PATH: ./firebase/assessment deploy-admin-indexes: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Admin Indexes runs-on: ubuntu-latest steps: @@ -44,10 +47,11 @@ jobs: with: args: deploy --only firestore:indexes env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN_DEV }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ADMIN_DEV }} PROJECT_ID: gse-roar-admin-dev PROJECT_PATH: ./firebase/admin deploy-assessment-indexes: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Assessment Indexes runs-on: ubuntu-latest steps: @@ -58,6 +62,6 @@ jobs: with: args: deploy --only firestore:indexes env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ASSESSMENT_DEV }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ASSESSMENT_DEV }} PROJECT_ID: gse-roar-assessment-dev PROJECT_PATH: ./firebase/assessment diff --git a/.github/workflows/deploy-firestore-rules-indexes-production.yml b/.github/workflows/deploy-firestore-rules-indexes-production.yml index 242fbf463..d20c860f2 100644 --- a/.github/workflows/deploy-firestore-rules-indexes-production.yml +++ b/.github/workflows/deploy-firestore-rules-indexes-production.yml @@ -8,6 +8,7 @@ name: Deploy Firestore Rules and Indexes (Production) jobs: deploy-admin-rules: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Admin Rules runs-on: ubuntu-latest steps: @@ -18,10 +19,11 @@ jobs: with: args: deploy --only firestore:rules env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ADMIN_PROD }} PROJECT_ID: gse-roar-admin PROJECT_PATH: ./firebase/admin deploy-assessment-rules: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Assessment Rules runs-on: ubuntu-latest steps: @@ -32,10 +34,11 @@ jobs: with: args: deploy --only firestore:rules env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ASSESSMENT }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ASSESSMENT_PROD }} PROJECT_ID: gse-roar-assessment PROJECT_PATH: ./firebase/assessment deploy-admin-indexes: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Admin Indexes runs-on: ubuntu-latest steps: @@ -46,10 +49,11 @@ jobs: with: args: deploy --only firestore:indexes env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_ADMIN_PROD }} PROJECT_ID: gse-roar-admin PROJECT_PATH: ./firebase/admin deploy-assessment-indexes: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Assessment Indexes runs-on: ubuntu-latest steps: @@ -60,6 +64,6 @@ jobs: with: args: deploy --only firestore:indexes env: - GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ROAR_ASSESSMENT }} + GCP_SA_KEY: ${{ secrets.FIRESTORE_UPDATE_SERVICE_ACCOUNT_GSE_ASSESSMENT_PROD }} PROJECT_ID: gse-roar-assessment PROJECT_PATH: ./firebase/assessment diff --git a/.github/workflows/firebase-hosting-preview.yml b/.github/workflows/firebase-hosting-preview.yml index 0a8b9d3d5..b1bc5e310 100644 --- a/.github/workflows/firebase-hosting-preview.yml +++ b/.github/workflows/firebase-hosting-preview.yml @@ -10,7 +10,7 @@ concurrency: jobs: build-and-preview: name: Deploy Preview - if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -24,8 +24,8 @@ jobs: uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}' - projectId: gse-roar-admin + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ADMIN_PROD }}' + projectId: '${{ secrets.FIREBASE_PROJECT_ID_ADMIN_PROD }}' target: staging - run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }} outputs: diff --git a/.github/workflows/firebase-hosting-production.yml b/.github/workflows/firebase-hosting-production.yml index 93e21fd1d..6b6a77c36 100644 --- a/.github/workflows/firebase-hosting-production.yml +++ b/.github/workflows/firebase-hosting-production.yml @@ -10,6 +10,7 @@ name: Deploy to Firebase Hosting (production) with Pre-Release Tests - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' jobs: # pre-release-tests: + # if: github.repository == 'yeatmanlab/roar-dashboard' # name: Run Cypress Pre-Release Tests # needs: [build-and-preview] # runs-on: ubuntu-latest @@ -45,6 +46,7 @@ jobs: # ci-build-id: ${{ github.run_id }}-${{ matrix.browser }} build-and-deploy: + if: github.repository == 'yeatmanlab/roar-dashboard' name: Deploy to Firebase Production Hosting Channel # needs: [pre-release-tests] runs-on: ubuntu-latest @@ -60,9 +62,9 @@ jobs: - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ADMIN_PROD }}' channelId: live - projectId: gse-roar-admin + projectId: '${{ secrets.FIREBASE_PROJECT_ID_ADMIN_PROD }}' target: production - name: Create Sentry release and upload source maps diff --git a/.github/workflows/firebase-hosting-staging.yml b/.github/workflows/firebase-hosting-staging.yml index 88ab7facb..cdc36d3ff 100644 --- a/.github/workflows/firebase-hosting-staging.yml +++ b/.github/workflows/firebase-hosting-staging.yml @@ -8,6 +8,7 @@ name: Deploy to Firebase Hosting (staging) - main jobs: build_and_deploy: + if: github.repository == 'yeatmanlab/roar-dashboard' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -21,7 +22,7 @@ jobs: - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ADMIN_PROD }}' channelId: live - projectId: gse-roar-admin + projectId: '${{ secrets.FIREBASE_PROJECT_ID_ADMIN_PROD }}' target: staging