ajusta cd_prod #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Cloud Run from Source | |
on: | |
push: | |
branches: | |
- main | |
env: | |
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} # TODO: update Google Cloud project id | |
SERVICE: emd-desafio-devops-caio # TODO: update Cloud Run service name | |
REGION: us-central1-c # TODO: update Cloud Run service region | |
jobs: | |
deploy: | |
# Add 'id-token' with the intended permissions for workload identity federation | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Google Cloud CLI | |
uses: google-github-actions/[email protected] | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
export_default_credentials: true | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v0 | |
with: | |
service: ${{ env.SERVICE }} | |
region: ${{ env.REGION }} | |
# NOTE: If required, update to the appropriate source folder | |
source: ./ | |
# If required, use the Cloud Run url output in later steps | |
- name: Show Output | |
run: echo ${{ steps.deploy.outputs.url }} |