Skip to content

add example deploy action #1

add example deploy action

add example deploy action #1

Workflow file for this run

name: Deploy to Cloud Run
on:
# push:
# branches:
# - $default-branch
env:
SERVICE: transaction-bench-eu
REGION: europe-north1
obs:
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: Google Auth
id: auth
uses: 'google-github-actions/auth@v2'
with:
token_format: 'access_token'
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' # e.g. - projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' # e.g. - [email protected]
# NOTE: Alternative option - authentication via credentials json
# - name: Google Auth
# id: auth
# uses: 'google-github-actions/auth@v2'
# with:
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
# token_format: 'access_token'
# Create Cloud Run YAML Service specification from template
# envsubst is replacing template variables and creating a YAML Service specification with the new image tag
- name: Create Service declearation
run: |-
export TAG="latest"
envsubst < ./workflows/service.template.yaml > service.yaml
# Deploy Cloud Run Service from the YAML Service specification
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
metadata: service.yaml
# If required, use the Cloud Run url output in later steps
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}