Skip to content

Commit

Permalink
pass the environment variables explicitly as inputs to the reusable w…
Browse files Browse the repository at this point in the history
…orkflow
  • Loading branch information
cru-Luis-Rodriguez committed Oct 29, 2024
1 parent 612da9a commit 2cedefc
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build-deploy-cloudrun-function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ on:
type: string
required: true


jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -77,23 +76,23 @@ 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

- 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
Expand All @@ -110,4 +109,4 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
body: output

0 comments on commit 2cedefc

Please sign in to comment.