From 9a3b38179ae05568a6f3d03e7d1533bb1ff7e52b Mon Sep 17 00:00:00 2001 From: Darren Lester Date: Sat, 14 Sep 2024 14:49:52 +0100 Subject: [PATCH] Make env vars available to all jobs --- .github/workflows/build-and-test.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index bf50966..7822d2c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,11 +8,21 @@ on: paths: - 'app/**' # Only run if our push contains a file in the app folder - workflow_dispatch: # Allows manual triggering of the workflow. Only works with default branch. + workflow_dispatch: # Allows manual triggering of the workflow. permissions: contents: read +env: + PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + SVC_ACCOUNT: ${{ secrets.GCP_SVC_ACCOUNT }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/${{ secrets.GCP_SVC_ACCOUNT }}.json + SVC_ACCOUNT_EMAIL: ${{ secrets.GCP_SVC_ACCOUNT }}@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com + REGION: ${{ vars.GCP_REGION }} + FUNCTIONS_PORT: ${{ vars.GCP_DEV_FUNCTIONS_PORT}} + FLASK_RUN_PORT: ${{ vars.FLASK_RUN_PORT }} + BACKEND_GCF: https://${{ vars.GCP_REGION }}-${{ secrets.GCP_PROJECT_ID }}.${{ vars.GCP_FUNCTION_URI_SUFFIX }} + jobs: build-and-test: runs-on: ubuntu-latest @@ -25,16 +35,6 @@ jobs: - app/backend_gcf - app/ui_cr - env: - PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} - SVC_ACCOUNT: ${{ secrets.GCP_SVC_ACCOUNT }} - GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/${{ secrets.GCP_SVC_ACCOUNT }}.json - SVC_ACCOUNT_EMAIL: ${{ secrets.GCP_SVC_ACCOUNT }}@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com - REGION: ${{ vars.GCP_REGION }} - FUNCTIONS_PORT: ${{ vars.GCP_DEV_FUNCTIONS_PORT}} - FLASK_RUN_PORT: ${{ vars.FLASK_RUN_PORT }} - BACKEND_GCF: https://${{ vars.GCP_REGION }}-${{ secrets.GCP_PROJECT_ID }}.${{ vars.GCP_FUNCTION_URI_SUFFIX }} - steps: - uses: actions/checkout@v4