From 1cd847d049f3bcaed23dce8e74a2d9eb2f5c04bb Mon Sep 17 00:00:00 2001 From: Silvio Tomatis Date: Wed, 31 Jan 2024 11:48:31 +0100 Subject: [PATCH] Use a sentry release in cloud functions too --- .github/workflow.templates/deploy-production.yml | 15 ++++++++++++++- .github/workflows/deploy-production.yml | 15 ++++++++++++++- packages/functions/src/constants.ts | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflow.templates/deploy-production.yml b/.github/workflow.templates/deploy-production.yml index 4ece3e1ee..d07c9e20d 100644 --- a/.github/workflow.templates/deploy-production.yml +++ b/.github/workflow.templates/deploy-production.yml @@ -43,7 +43,7 @@ jobs: REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_IGORICE_DSN }} REACT_APP_SENTRY_ENVIRONMENT: production REACT_APP_SENTRY_RELEASE: ${{ env.SENTRY_RELEASE }} - - name: Create Sentry release + - name: Create Sentry release for client app uses: getsentry/action-release@v1 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} @@ -54,10 +54,23 @@ jobs: environment: production sourcemaps: "./packages/client/dist/assets" version: ${{ env.SENTRY_RELEASE }} + - name: Create Sentry release for client app + uses: getsentry/action-release@v1 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: eisbuk + SENTRY_PROJECT: 'functions' + SENTRY_URL: ${{ secrets.SENTRY_URL }} + with: + environment: production + sourcemaps: "./packages/functions/dist/" + version: ${{ env.SENTRY_RELEASE }} - name: Deploy to firebase run: | echo FUNCTIONS_SENTRY_DSN="$FUNCTIONS_SENTRY_DSN" > packages/functions/.env + echo REACT_APP_SENTRY_RELEASE="$REACT_APP_SENTRY_RELEASE" >> packages/functions/.env rush deploy:production env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_EISBUK }} FUNCTIONS_SENTRY_DSN: ${{ secrets.FUNCTIONS_SENTRY_DSN }} + REACT_APP_SENTRY_RELEASE: ${{ env.SENTRY_RELEASE }} diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index b254510d0..046de9aa3 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -51,7 +51,7 @@ jobs: REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_IGORICE_DSN }} REACT_APP_SENTRY_ENVIRONMENT: production REACT_APP_SENTRY_RELEASE: ${{ env.SENTRY_RELEASE }} - - name: Create Sentry release + - name: Create Sentry release for client app uses: getsentry/action-release@v1 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} @@ -62,10 +62,23 @@ jobs: environment: production sourcemaps: ./packages/client/dist/assets version: ${{ env.SENTRY_RELEASE }} + - name: Create Sentry release for client app + uses: getsentry/action-release@v1 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: eisbuk + SENTRY_PROJECT: functions + SENTRY_URL: ${{ secrets.SENTRY_URL }} + with: + environment: production + sourcemaps: ./packages/client/dist/assets + version: ${{ env.SENTRY_RELEASE }} - name: Deploy to firebase run: | echo FUNCTIONS_SENTRY_DSN="$FUNCTIONS_SENTRY_DSN" > packages/functions/.env + echo REACT_APP_SENTRY_RELEASE="$REACT_APP_SENTRY_RELEASE" >> packages/functions/.env rush deploy:production env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_EISBUK }} FUNCTIONS_SENTRY_DSN: ${{ secrets.FUNCTIONS_SENTRY_DSN }} + REACT_APP_SENTRY_RELEASE: ${{ env.SENTRY_RELEASE }} diff --git a/packages/functions/src/constants.ts b/packages/functions/src/constants.ts index afc181035..43dea9bea 100644 --- a/packages/functions/src/constants.ts +++ b/packages/functions/src/constants.ts @@ -6,12 +6,14 @@ export const __smsUrl__ = "https://gatewayapi.com/rest/mtsms"; export const __isEmulator__ = process.env.FUNCTIONS_EMULATOR === "true"; export const __sentryDSN__ = process.env.FUNCTIONS_SENTRY_DSN; +export const __sentryRelease__ = process.env.REACT_APP_SENTRY_RELEASE; export const __enableSentry__ = !process.env.FUNCTIONS_EMULATOR && Boolean(__sentryDSN__); if (__enableSentry__) { Sentry.init({ dsn: __sentryDSN__, + release: __sentryRelease__, tracesSampleRate: 1.0, }); }