Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ jobs:

build-docs:
name: Build Docs
needs: [lint]
needs: [lint, build-binary]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -674,18 +674,50 @@ jobs:
key: node-modules-${{ hashFiles('bun.lock', 'patches/**') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- name: Get CLI version
id: version
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
- name: Download compiled CLI binary
uses: actions/download-artifact@v8
with:
name: sentry-linux-x64
path: dist-bin
- name: Make binary executable
run: chmod +x dist-bin/sentry-linux-x64
- name: Generate docs content
run: bun run generate:schema && bun run generate:docs
- name: Build Docs
working-directory: docs
env:
PUBLIC_SENTRY_ENVIRONMENT: production
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
run: |
bun install --frozen-lockfile
bun run build
# Inject debug IDs and upload sourcemaps. The inject step adds
# //# debugId= and the _sentryDebugIds IIFE to deployed JS files.
# Both steps require SENTRY_AUTH_TOKEN (the CLI checks auth on startup).
- name: Inject debug IDs and upload sourcemaps
if: github.event_name == 'push' && env.SENTRY_AUTH_TOKEN != ''
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sentry
SENTRY_PROJECT: cli-website
run: |
./dist-bin/sentry-linux-x64 sourcemap inject docs/dist/
./dist-bin/sentry-linux-x64 sourcemap upload docs/dist/ \
--release "${{ steps.version.outputs.version }}" \
--url-prefix "~/"
# Remove .map files — they were uploaded to Sentry but shouldn't
# be deployed to production.
- name: Remove sourcemaps from output
run: find docs/dist -name '*.map' -delete
- name: Package Docs
run: |
cp .nojekyll docs/dist/
cd docs/dist && zip -r ../../gh-pages.zip .
- name: Upload artifact
- name: Upload docs artifact
uses: actions/upload-artifact@v7
with:
name: gh-pages
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile

- name: Get CLI version
id: version
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"

- name: Generate docs content
run: bun run generate:schema && bun run generate:docs

Expand All @@ -39,10 +43,29 @@ jobs:
env:
# Override base path for PR preview (no /cli prefix since preview domain is different)
DOCS_BASE_PATH: /pr-preview/pr-${{ github.event.pull_request.number }}
PUBLIC_SENTRY_ENVIRONMENT: staging
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
PUBLIC_SENTRY_RELEASE: ${{ steps.version.outputs.version }}
run: |
bun install --frozen-lockfile
bun run build

- name: Inject debug IDs and upload sourcemaps
if: env.SENTRY_AUTH_TOKEN != ''
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sentry
SENTRY_PROJECT: cli-website
run: |
bun run --bun src/bin.ts sourcemap inject docs/dist/
bun run --bun src/bin.ts sourcemap upload docs/dist/ \
--release "${{ steps.version.outputs.version }}" \
--url-prefix "~/"

# Remove .map files — uploaded to Sentry but shouldn't be deployed.
- name: Remove sourcemaps from output
run: find docs/dist -name '*.map' -delete

- name: Ensure .nojekyll at gh-pages root
run: |
git config user.name "github-actions[bot]"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sentry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
# The org/ prefix is how org is specified — it is NOT part of the version.
# The version portion must match Sentry.init({ release }) exactly.
- name: Create release
run: sentry release create "sentry/${VERSION}" --project cli
run: sentry release create "sentry/${VERSION}" --project cli,cli-website

# --auto matches the local origin remote against Sentry repo integrations.
# continue-on-error: integration may not be configured for all orgs.
Expand Down
21 changes: 17 additions & 4 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,27 @@ export default defineConfig({
markdown: {
smartypants: false,
},
// Generate sourcemaps for Sentry. "hidden" produces .map files without
// adding //# sourceMappingURL comments to the output (the debug IDs
// injected post-build by `sentry sourcemap inject` are used instead).
vite: {
build: {
sourcemap: "hidden",
},
},
integrations: [
sentry({
project: "cli-website",
org: "sentry",
authToken: process.env.SENTRY_AUTH_TOKEN,
sourceMapsUploadOptions: {
enabled: !!process.env.SENTRY_AUTH_TOKEN,
},
environment: process.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
// Note: @sentry/astro v10 does not support the `release` build-time
// option (todo(v11) in the source). Release is set in Sentry.init()
// via PUBLIC_SENTRY_RELEASE / SENTRY_RELEASE env vars instead.
//
// Disable the plugin's sourcemap upload — it pulls in @sentry/cli
// (20+ MB binary download). We use our own CLI post-build instead
// (see CI workflow: `sentry sourcemap inject` + `sentry sourcemap upload`).
sourceMapsUploadOptions: { enabled: false },
}),
starlight({
title: "Sentry CLI",
Expand Down
2 changes: 2 additions & 0 deletions docs/sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as Sentry from "@sentry/astro";

Sentry.init({
dsn: "https://2aca5fe97c71868bc3aa7fb48620dc39@o1.ingest.us.sentry.io/4510798755856384",
environment: import.meta.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
release: import.meta.env.PUBLIC_SENTRY_RELEASE || undefined,
sendDefaultPii: true,
integrations: [
Sentry.browserTracingIntegration(),
Expand Down
2 changes: 2 additions & 0 deletions docs/sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as Sentry from "@sentry/astro";

Sentry.init({
dsn: "https://2aca5fe97c71868bc3aa7fb48620dc39@o1.ingest.us.sentry.io/4510798755856384",
environment: process.env.PUBLIC_SENTRY_ENVIRONMENT ?? "development",
release: process.env.SENTRY_RELEASE || undefined,
sendDefaultPii: true,
enableLogs: true,
tracesSampleRate: 1.0,
Expand Down
Loading