Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/deployment-prod-canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ on:
required: true
default: '10'
description: New Cloud Run revision traffic percentage
options:
options:
- 0
- 10
- 25
- 50
Expand All @@ -26,7 +27,8 @@ on:
required: true
default: '90'
description: Old Cloud Run revision traffic percentage
options:
options:
- 0
- 10
- 25
- 50
Expand Down
31 changes: 6 additions & 25 deletions .github/workflows/deployment-prod-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ on:
release:
types: [published]
jobs:
image-build-push:
name: "Image Build & Push"
image-tag:
name: "Image tag to latest"
runs-on: ubuntu-latest
environment: prod
permissions:
Expand All @@ -21,33 +21,14 @@ jobs:
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. - my-service-account@my-project.iam.gserviceaccount.com

# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Authentication
id: docker-auth
uses: 'docker/login-action@v1'
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ vars.region }}-docker.pkg.dev'
#TODO: ONLY tag, don't build
- name: Build and Tag
id: build-image
uses: docker/build-push-action@v3
with:
context: ${{ vars.code_directory }}
push: true
tags: |
${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.event.release.tag_name }}
${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:latest

#TODO: ONLY tag, don't build
- name: Docker Push
- name: tag
shell: bash
run: |-
docker push "${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.event.release.tag_name }}"
docker push "${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:latest"

gcloud artifacts docker tags add \
"${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:latest" \
"${{ vars.region }}-docker.pkg.dev/${{ vars.artifact_registry_project }}/${{ vars.artifact_registry_repo }}/${{ vars.service_name }}:${{ github.event.release.tag_name }}"
deploy-prod:
if: contains(fromJSON('["main"]'), github.ref_name) && ${{ inputs.environment }} == "prod"
name: "Cloud Run Deployment"
Expand Down