diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml new file mode 100644 index 000000000..36f03683d --- /dev/null +++ b/.github/workflows/sentry-release.yml @@ -0,0 +1,35 @@ +name: Sentry Release +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + finalize: + name: Finalize Sentry Release + runs-on: ubuntu-latest + # Skip pre-releases (nightlies, dev versions) + if: "!github.event.release.prerelease" + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + # Tag names are bare semver (e.g., "0.24.0", no "v" prefix), + # matching both the npm package version and Sentry release version. + VERSION: ${{ github.event.release.tag_name }} + steps: + - name: Install CLI + run: npm install -g "sentry@${VERSION}" + + - name: Create release + run: sentry release create "sentry/${VERSION}" --project cli + + - name: Set commits + continue-on-error: true + run: sentry release set-commits "sentry/${VERSION}" --auto + + - name: Finalize release + run: sentry release finalize "sentry/${VERSION}" + + - name: Create deploy + run: sentry release deploy "sentry/${VERSION}" production diff --git a/AGENTS.md b/AGENTS.md index 6b88e7012..c62bcae8f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -61,6 +61,14 @@ bun run test:unit # Run unit tests only bun run test:e2e # Run e2e tests only ``` +## Rules: No Runtime Dependencies + +**CRITICAL**: All packages must be in `devDependencies`, never `dependencies`. Everything is bundled at build time via esbuild. CI enforces this with `bun run check:deps`. + +When adding a package, always use `bun add -d ` (the `-d` flag). + +When the `@sentry/api` SDK provides types for an API response, import them directly from `@sentry/api` instead of creating redundant Zod schemas in `src/types/sentry.ts`. + ## Rules: Use Bun APIs **CRITICAL**: This project uses Bun as runtime. Always prefer Bun-native APIs over Node.js equivalents. @@ -1038,4 +1046,7 @@ mock.module("./some-module", () => ({ * **validateWidgetEnums skipDeprecatedCheck for edit-path inherited datasets**: When editing a widget, \`effectiveDataset = flags.dataset ?? existing.widgetType\` may inherit a deprecated type (e.g., \`discover\`). The \`validateWidgetEnums\` deprecation check must be skipped for inherited values — only fire when the user explicitly passes \`--dataset\`. Solution: \`validateWidgetEnums(effectiveDisplay, effectiveDataset, { skipDeprecatedCheck: true })\` in \`edit.ts\`. The cross-validation between display type and dataset still runs on effective values, catching incompatible combos. The deprecation rejection helper \`rejectInvalidDataset()\` is extracted to keep \`validateWidgetEnums\` under Biome's complexity limit of 15. + + +* **set-commits default mode makes speculative --auto API call by design**: When \`release set-commits\` is called without \`--auto\` or \`--local\`, it tries auto-discovery first and falls back to local git on 400 error. This matches the reference sentry-cli behavior (parity-correct). A per-org negative cache in the \`metadata\` table (\`repos_configured.\` = \`"false"\`, 1-hour TTL) skips the speculative auto call on subsequent runs when no repo integration is configured. The cache clears on successful auto-discovery. diff --git a/docs/public/.well-known/skills/index.json b/docs/public/.well-known/skills/index.json index d7e648a67..2ddb8279c 100644 --- a/docs/public/.well-known/skills/index.json +++ b/docs/public/.well-known/skills/index.json @@ -13,6 +13,7 @@ "references/logs.md", "references/organizations.md", "references/projects.md", + "references/release.md", "references/setup.md", "references/sourcemap.md", "references/teams.md", diff --git a/docs/src/content/docs/commands/index.md b/docs/src/content/docs/commands/index.md index f688a0482..2961f29a7 100644 --- a/docs/src/content/docs/commands/index.md +++ b/docs/src/content/docs/commands/index.md @@ -14,6 +14,7 @@ The Sentry CLI provides commands for interacting with various Sentry resources. | [`dashboard`](./dashboard/) | Manage Sentry dashboards | | [`org`](./org/) | Work with Sentry organizations | | [`project`](./project/) | Work with Sentry projects | +| [`release`](./release/) | Work with Sentry releases | | [`repo`](./repo/) | Work with Sentry repositories | | [`team`](./team/) | Work with Sentry teams | | [`issue`](./issue/) | Manage Sentry issues | diff --git a/docs/src/content/docs/commands/release.md b/docs/src/content/docs/commands/release.md new file mode 100644 index 000000000..62b3ed784 --- /dev/null +++ b/docs/src/content/docs/commands/release.md @@ -0,0 +1,192 @@ +--- +title: release +description: Release commands for the Sentry CLI +--- + +Work with Sentry releases + +## Commands + +### `sentry release list ` + +List releases + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | <org>/ (all projects), <org>/<project>, or <project> (search) | + +**Options:** + +| Option | Description | +|--------|-------------| +| `-n, --limit ` | Maximum number of releases to list (default: "30") | +| `-f, --fresh` | Bypass cache, re-detect projects, and fetch fresh data | +| `-c, --cursor ` | Navigate pages: "next", "prev", "first" (or raw cursor string) | + +### `sentry release view ` + +View release details + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | [<org>/]<version> - Release version to view | + +**Options:** + +| Option | Description | +|--------|-------------| +| `-f, --fresh` | Bypass cache, re-detect projects, and fetch fresh data | + +### `sentry release create ` + +Create a release + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | [<org>/]<version> - Release version to create | + +**Options:** + +| Option | Description | +|--------|-------------| +| `-p, --project ` | Associate with project(s), comma-separated | +| `--finalize` | Immediately finalize the release (set dateReleased) | +| `--ref ` | Git ref (branch or tag name) | +| `--url ` | URL to the release source | +| `-n, --dry-run` | Show what would happen without making changes | + +### `sentry release finalize ` + +Finalize a release + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | [<org>/]<version> - Release version to finalize | + +**Options:** + +| Option | Description | +|--------|-------------| +| `--released ` | Custom release timestamp (ISO 8601). Defaults to now. | +| `--url ` | URL for the release | +| `-n, --dry-run` | Show what would happen without making changes | + +### `sentry release delete ` + +Delete a release + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | [<org>/]<version> - Release version to delete | + +**Options:** + +| Option | Description | +|--------|-------------| +| `-y, --yes` | Skip confirmation prompt | +| `-f, --force` | Force the operation without confirmation | +| `-n, --dry-run` | Show what would happen without making changes | + +### `sentry release deploy ` + +Create a deploy for a release + +**Arguments:** + +| Argument | Description | +|----------|-------------| +| `` | [<org>/]<version> <environment> [name] | + +**Options:** + +| Option | Description | +|--------|-------------| +| `--url ` | URL for the deploy | +| `--started ` | Deploy start time (ISO 8601) | +| `--finished ` | Deploy finish time (ISO 8601) | +| `-t, --time