From bcbcbd12f2e2da819926a58564455d6ee95b99e7 Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Tue, 24 Mar 2026 00:53:23 +0300 Subject: [PATCH 1/3] Fix Sentry release number --- .github/workflows/deployment-preview.yml | 2 + .github/workflows/deployment-production.yml | 2 + astro.config.ts | 11 ++- .../Pwa/PrefetchOfflinePage/index.astro | 46 ++++++++++++- .../scripts/errors/__tests__/handler.spec.ts | 8 +++ src/components/scripts/errors/handler.ts | 4 ++ src/integrations/PackageRelease/index.ts | 68 ++++++++++++++++--- 7 files changed, 126 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deployment-preview.yml b/.github/workflows/deployment-preview.yml index 3d03a850c..397a11329 100644 --- a/.github/workflows/deployment-preview.yml +++ b/.github/workflows/deployment-preview.yml @@ -26,6 +26,7 @@ jobs: PUBLIC_GOOGLE_MAPS_API_KEY: ${{ vars.PUBLIC_GOOGLE_MAPS_API_KEY }} PUBLIC_GOOGLE_MAP_ID: ${{ vars.PUBLIC_GOOGLE_MAP_ID }} PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} PUBLIC_UPSTASH_SEARCH_REST_URL: ${{ vars.PUBLIC_UPSTASH_SEARCH_REST_URL }} PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN: ${{ vars.PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN }} VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }} @@ -69,6 +70,7 @@ jobs: - name: Vercel build (preview) env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} run: vercel build --token=${VERCEL_TOKEN} - name: Deploy to Vercel (preview) diff --git a/.github/workflows/deployment-production.yml b/.github/workflows/deployment-production.yml index d9e787ac5..c6de0b8f9 100644 --- a/.github/workflows/deployment-production.yml +++ b/.github/workflows/deployment-production.yml @@ -23,6 +23,7 @@ jobs: PUBLIC_GOOGLE_MAPS_API_KEY: ${{ vars.PUBLIC_GOOGLE_MAPS_API_KEY }} PUBLIC_GOOGLE_MAP_ID: ${{ vars.PUBLIC_GOOGLE_MAP_ID }} PUBLIC_SENTRY_DSN: ${{ vars.PUBLIC_SENTRY_DSN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} PUBLIC_UPSTASH_SEARCH_REST_URL: ${{ vars.PUBLIC_UPSTASH_SEARCH_REST_URL }} PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN: ${{ vars.PUBLIC_UPSTASH_SEARCH_READONLY_TOKEN }} VERCEL_ORG_ID: ${{ vars.VERCEL_ORG_ID }} @@ -63,6 +64,7 @@ jobs: env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} NODE_ENV: production + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} run: vercel build --prod --token=${VERCEL_TOKEN} ## diff --git a/astro.config.ts b/astro.config.ts index d32bb9fd1..e5cf7d74f 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -33,6 +33,7 @@ import { callToActionValidator } from './src/integrations/CtaValidator' import { faviconGenerator } from './src/integrations/FaviconGenerator' import { packageRelease } from './src/integrations/PackageRelease' import { privacyPolicyVersion } from './src/integrations/PrivacyPolicyVersion' +import { getPackageRelease, packageRelease } from './src/integrations/PackageRelease' import { testimonialsLengthWarning } from './src/integrations/TestimonialsLengthWarning' import { fixContentAssetPropagation } from './src/lib/plugins/fixContentAssetPropagation' import { pwaDevAssetServer } from './src/lib/plugins/pwaDevAssetServer' @@ -41,6 +42,9 @@ import { createSerializeFunction, pagesJsonWriter } from './src/integrations/sit // Ensure Vite's HMR websocket connects through the same exposed dev server port used by Astro. const devServerPort = Number(process.env['DEV_SERVER_PORT'] ?? 4321) const viteLogger = createLogger(undefined, { allowClearScreen: false }) +const sentryAuthToken = process.env['SENTRY_AUTH_TOKEN'] +const sentryRelease = getPackageRelease() +const shouldEnableSentryIntegration = Boolean(sentryAuthToken) const shouldSuppressViteWarning = (message: string): boolean => { return ( @@ -82,11 +86,12 @@ const standardIntegrations = [ privacyPolicyVersion(), /** Warn when testimonial bodies are too short/too long (helps keep carousel cards consistent) */ testimonialsLengthWarning({ min: 300, max: 400 }), - /** Only include Sentry integration in Vercel environments */ - ...(isVercel() ? [sentry({ + /** Enable Sentry build integration when CI provides upload credentials. */ + ...(shouldEnableSentryIntegration ? [sentry({ project: "webstack-builders-corporate-website", org: "webstack-builders", - authToken: getSentryAuthToken(), + authToken: sentryAuthToken, + release: sentryRelease, })] : []), sitemap({ serialize: createSerializeFunction({ diff --git a/src/components/Pwa/PrefetchOfflinePage/index.astro b/src/components/Pwa/PrefetchOfflinePage/index.astro index 16245f543..08ee08013 100644 --- a/src/components/Pwa/PrefetchOfflinePage/index.astro +++ b/src/components/Pwa/PrefetchOfflinePage/index.astro @@ -7,6 +7,25 @@