Skip to content

Commit

Permalink
platform/#2231: use artifact registry instead of GCR and update actio…
Browse files Browse the repository at this point in the history
…ns (#238)
  • Loading branch information
Monska85 authored Feb 14, 2025
1 parent 76916c3 commit 8a7125f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/cloud-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:

env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
IMAGE_REGISTRY: europe-west1-docker.pkg.dev
IMAGE_REPOSITORY: ${{ secrets.RUN_PROJECT }}/sparkfabrik-applications
RUN_REGION: europe-west1
SERVICE_NAME: company-playbook
SERVICE_ACCOUNT: ${{ secrets.CLOUD_RUN_SERVICE_ACCOUNT }}
Expand All @@ -32,16 +34,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: google-github-actions/auth@v1
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.RUN_SA_CREDS }}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@v1
- uses: google-github-actions/setup-gcloud@v2
with:
version: "411.0.0"
#service_account_key: ${{ secrets.RUN_SA_KEY }}
project_id: ${{ secrets.RUN_PROJECT }}

Expand All @@ -50,22 +51,22 @@ jobs:
run: |-
gcloud builds submit \
--quiet \
--tag "eu.gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
--tag "${IMAGE_REGISTRY}/${IMAGE_REPOSITORY}/${SERVICE_NAME}:${GITHUB_SHA}"
# Deploy image to Cloud Run
- name: Deploy
run: |-
gcloud run deploy "$SERVICE_NAME" \
gcloud run deploy "${SERVICE_NAME}" \
--quiet \
--region "$RUN_REGION" \
--image "eu.gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--region "${RUN_REGION}" \
--image "${IMAGE_REGISTRY}/${IMAGE_REPOSITORY}/${SERVICE_NAME}:${GITHUB_SHA}" \
--platform "managed" \
--service-account="$SERVICE_ACCOUNT" \
--service-account="${SERVICE_ACCOUNT}" \
--allow-unauthenticated
# Update traffic routing to send all traffic to the latest revision
- name: Update traffic
run: |-
gcloud run services update-traffic "$SERVICE_NAME" \
--region "$RUN_REGION" \
gcloud run services update-traffic "${SERVICE_NAME}" \
--region "${RUN_REGION}" \
--to-latest

0 comments on commit 8a7125f

Please sign in to comment.