Skip to content

Commit 2cf3d4a

Browse files
committed
fix: set release in Sentry.init (v10 ignores build option), clean up .map in preview
- Remove release option from sentry() integration (ignored in @sentry/astro v10) - Set release in Sentry.init() via PUBLIC_SENTRY_RELEASE/SENTRY_RELEASE env vars - Add .map file cleanup to docs-preview.yml before deploy
1 parent 4cde4be commit 2cf3d4a

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ jobs:
691691
env:
692692
PUBLIC_SENTRY_ENVIRONMENT: production
693693
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
694+
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
694695
run: |
695696
bun install --frozen-lockfile
696697
bun run build

.github/workflows/docs-preview.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
DOCS_BASE_PATH: /pr-preview/pr-${{ github.event.pull_request.number }}
4646
PUBLIC_SENTRY_ENVIRONMENT: staging
4747
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
48+
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
4849
run: |
4950
bun install --frozen-lockfile
5051
bun run build
@@ -61,6 +62,10 @@ jobs:
6162
--release "${{ steps.version.outputs.version }}" \
6263
--url-prefix "~/"
6364
65+
# Remove .map files — uploaded to Sentry but shouldn't be deployed.
66+
- name: Remove sourcemaps from output
67+
run: find docs/dist -name '*.map' -delete
68+
6469
- name: Ensure .nojekyll at gh-pages root
6570
run: |
6671
git config user.name "github-actions[bot]"

docs/astro.config.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import { defineConfig } from "astro/config";
55
// Allow base path override via environment variable for PR previews
66
const base = process.env.DOCS_BASE_PATH || "/";
77

8-
// Release name from CI (root package.json version). Undefined in local dev.
9-
const release = process.env.SENTRY_RELEASE;
10-
118
export default defineConfig({
129
site: "https://cli.sentry.dev",
1310
base,
@@ -27,7 +24,10 @@ export default defineConfig({
2724
project: "cli-website",
2825
org: "sentry",
2926
environment: process.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
30-
release: release ? { name: release } : undefined,
27+
// Note: @sentry/astro v10 does not support the `release` build-time
28+
// option (todo(v11) in the source). Release is set in Sentry.init()
29+
// via PUBLIC_SENTRY_RELEASE / SENTRY_RELEASE env vars instead.
30+
//
3131
// Disable the plugin's sourcemap upload — it pulls in @sentry/cli
3232
// (20+ MB binary download). We use our own CLI post-build instead
3333
// (see CI workflow: `sentry sourcemap inject` + `sentry sourcemap upload`).

docs/sentry.client.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as Sentry from "@sentry/astro";
33
Sentry.init({
44
dsn: "https://2aca5fe97c71868bc3aa7fb48620dc39@o1.ingest.us.sentry.io/4510798755856384",
55
environment: import.meta.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
6+
release: import.meta.env.PUBLIC_SENTRY_RELEASE || undefined,
67
sendDefaultPii: true,
78
integrations: [
89
Sentry.browserTracingIntegration(),

docs/sentry.server.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as Sentry from "@sentry/astro";
33
Sentry.init({
44
dsn: "https://2aca5fe97c71868bc3aa7fb48620dc39@o1.ingest.us.sentry.io/4510798755856384",
55
environment: process.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
6+
release: process.env.SENTRY_RELEASE || undefined,
67
sendDefaultPii: true,
78
enableLogs: true,
89
tracesSampleRate: 1.0,

0 commit comments

Comments
 (0)