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..e30a187fd 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -21,18 +21,16 @@ import { createLogger, type LogOptions, type PluginOption } from 'vite' */ import { environmentalVariablesConfig, - getSentryAuthToken, getSiteUrl, isE2eTest, - isVercel, markdownConfig, pwaConfig, vercelConfig, } from './src/lib/config' 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 +39,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 +83,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({ - project: "webstack-builders-corporate-website", - org: "webstack-builders", - authToken: getSentryAuthToken(), + /** Enable Sentry build integration when CI provides upload credentials. */ + ...(shouldEnableSentryIntegration && sentryAuthToken ? [sentry({ + project: 'webstack-builders-corporate-website', + org: 'webstack-builders', + 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 @@