From 2cedefc9ad8b9964c60ab5aee0eecc77aef315c5 Mon Sep 17 00:00:00 2001 From: Luis Rodriguez Date: Tue, 29 Oct 2024 15:12:17 -0400 Subject: [PATCH] pass the environment variables explicitly as inputs to the reusable workflow --- .../workflows/build-deploy-cloudrun-function.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-deploy-cloudrun-function.yml b/.github/workflows/build-deploy-cloudrun-function.yml index 40ed60e..e2427f8 100644 --- a/.github/workflows/build-deploy-cloudrun-function.yml +++ b/.github/workflows/build-deploy-cloudrun-function.yml @@ -52,7 +52,6 @@ on: type: string required: true - jobs: build-and-deploy: runs-on: ubuntu-latest @@ -77,9 +76,9 @@ jobs: name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 with: - project_id: ${{ env.GCP_PROJECT_ID }} - workload_identity_provider: '/projects/${{ env.GCP_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/${{ env.WORKLOAD_IDENTITY_POOL }}/providers/${{ env.WORKLOAD_IDENTITY_PROVIDER }}' - service_account: '${{ env.GCP_SERVICE_ACCOUNT }}@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com' + project_id: ${{ inputs.GCP_PROJECT_ID }} + workload_identity_provider: 'projects/${{ inputs.GCP_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/${{ inputs.WORKLOAD_IDENTITY_POOL }}/providers/${{ inputs.WORKLOAD_IDENTITY_PROVIDER }}' + service_account: '${{ inputs.GCP_SERVICE_ACCOUNT }}@${{ inputs.GCP_PROJECT_ID }}.iam.gserviceaccount.com' - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v2 @@ -87,13 +86,13 @@ jobs: - name: Deploy to Cloud Run Functions id: deploy run: | - gcloud config set project ${{ env.GCP_PROJECT_ID }} + gcloud config set project ${{ inputs.GCP_PROJECT_ID }} gcloud functions deploy ${{ inputs.function_name }} \ - --region $GCP_REGION \ + --region ${{ inputs.GCP_REGION }} \ --source=./${{ inputs.function_name }} \ --entry-point=${{ inputs.entry_point }} \ --runtime=${{ inputs.runtime }} \ - --build-service-account=projects/${{ env.GCP_PROJECT_ID }}/serviceAccounts/${{ env.GCP_SERVICE_ACCOUNT_EMAIL }} \ + --build-service-account=projects/${{ inputs.GCP_PROJECT_ID }}/serviceAccounts/${{ inputs.GCP_SERVICE_ACCOUNT_EMAIL }} - uses: actions/github-script@v6 if: github.event.pull_request.merged == true @@ -110,4 +109,4 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: output + body: output \ No newline at end of file