update packages #1
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: Reusable Deployment | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
description: Name of the target environment. | ||
ref: | ||
type: string | ||
required: true | ||
description: The tag or SHA to checkout. | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Google Auth | ||
id: auth | ||
uses: ' | ||
with: | ||
token_format: 'access_token' | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
- name: Log ingo Google Artifact Registry | ||
id: docker-auth | ||
uses: docker/login-action@v3 | ||
with: | ||
username: 'oauth2accesstoken' | ||
password: '${{ steps.auth.outputs.access_token }}' | ||
registry: '${{ vars.REGION }}-docker.pkg.dev' | ||
- name: Build, tag and push container | ||
id: build-image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ vars.REGION }}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/${{ vars.ARTIFACT_REPO }}/${{ vars.SERVICE_NAME }}:latest | ||
- name: Create Service declaration | ||
run: |- | ||
export CONTAINER_IMAGE="${{ vars.REGION }}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/${{ vars.ARTIFACT_REPO }}/${{ vars.SERVICE_NAME }}:latest" | ||
export SERVICE_NAME="${{ vars.SERVICE_NAME }}" | ||
export PROJECT_ID="${{ vars.GCP_PROJECT_ID }}" | ||
export REVISION_TAG="${{ inputs.ref }}" | ||
export CLOUD_RUN_SA="${{ vars.CLOUD_RUN_SA }}" | ||
export ENVIRONMENT="${{ inputs.environment }}" | ||
envsubst < ./service-yaml/container.yaml > container-${{ inputs.environment }}.yaml | ||
cat container-${{ inputs.environment }}.yaml | ||
- name: Deploy to Cloud Run | ||
id: deploy | ||
uses: google-github-actions/deploy-cloudrun@v2 | ||
with: | ||
service: ${{ vars.SERVICE_NAME }} | ||
region: ${{ vars.REGION }} | ||
metadata: container-${{ inputs.environment }}.yaml |