Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Merged
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
20 changes: 12 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
deploy:
runs-on: ubuntu-latest
environment: production

# Add permissions to the job
permissions:
contents: "read"
id-token: "write"
# to avoid concurrent prod deployments on rapid pushes.
concurrency:
group: cd-${{ github.ref }}
cancel-in-progress: true

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

- name: Set up Docker Buildx
id: setup-buildx
uses: docker/setup-buildx-action@v3

- name: Cache
Expand Down Expand Up @@ -50,7 +50,9 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ vars.DOCKER_USERNAME }}/subscriptions:latest
tags: |-
${{ vars.DOCKER_USERNAME }}/subscriptions:latest
${{ vars.DOCKER_USERNAME }}/subscriptions:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -61,12 +63,13 @@ jobs:
credentials_json: "${{ secrets.GCP_SA_KEY }}"

- name: Deploy to Google Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ vars.GCP_CLOUD_RUN_SERVICE }} # The name of your Cloud Run service
region: ${{ vars.GCP_CLOUD_RUN_REGION }} # The region of your service (e.g., us-central1)
image: ${{ vars.DOCKER_USERNAME }}/subscriptions:latest
flags: '--allow-unauthenticated' # This flag grants public access
image: ${{ vars.DOCKER_USERNAME }}/subscriptions:${{ github.sha }}
flags: "--allow-unauthenticated" # This flag grants public access
env_vars: |-
RUST_LOG=${{ vars.RUST_LOG }}
SUBSCRIPTIONS__PORT=${{ vars.SUBSCRIPTIONS__PORT }}
Expand All @@ -80,6 +83,7 @@ jobs:
SUBSCRIPTIONS__EMAIL_CLIENT__SENDER_EMAIL=${{ vars.SUBSCRIPTIONS__EMAIL_CLIENT__SENDER_EMAIL }}
SUBSCRIPTIONS__EMAIL_CLIENT__BASE_URL=${{ vars.SUBSCRIPTIONS__EMAIL_CLIENT__BASE_URL }}
SUBSCRIPTIONS__EMAIL_CLIENT__AUTH_TOKEN=${{ secrets.SUBSCRIPTIONS__EMAIL_CLIENT__AUTH_TOKEN }}
SUBSCRIPTIONS__EMAIL_CLIENT__TIMEOUT=${{ vars.SUBSCRIPTIONS__EMAIL_CLIENT__TIMEOUT }}

- name: Deployment URL
run: 'echo "${{ steps.deploy.outputs.url }}"'
Loading