From 5d68e4d5658c51102db0abc99b8e3303c92ef052 Mon Sep 17 00:00:00 2001 From: Mustapha Date: Tue, 2 Sep 2025 10:25:21 +0100 Subject: [PATCH 1/3] fix: update cd (add messing env) --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f95d6d2..a20b5e7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -80,6 +80,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 }}"' From cc996b9a25af6ee74ff92510365cf35578eefc5e Mon Sep 17 00:00:00 2001 From: Mustapha Date: Tue, 2 Sep 2025 10:38:34 +0100 Subject: [PATCH 2/3] chore: improve cd --- .github/workflows/cd.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a20b5e7..6ccd8d5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -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 @@ -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 @@ -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 }} From ae8275bb6e70ddc259722fdcaafdef2592a42350 Mon Sep 17 00:00:00 2001 From: TN19N Date: Tue, 2 Sep 2025 10:46:53 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6ccd8d5..22e40ab 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -50,7 +50,7 @@ jobs: context: . file: ./Dockerfile push: true - tags: -| + tags: |- ${{ vars.DOCKER_USERNAME }}/subscriptions:latest ${{ vars.DOCKER_USERNAME }}/subscriptions:${{ github.sha }} cache-from: type=gha