Skip to content

Commit

Permalink
Improve GitHub action to include sentry sourcemap and release
Browse files Browse the repository at this point in the history
  • Loading branch information
icodesign committed Jan 2, 2025
1 parent 42f7b3a commit 0697b04
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-cooks-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rootapp/dolphin': patch
---

Improve GitHub action to include sentry sourcemap and release
27 changes: 27 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
node-version: 20
cache: 'pnpm'

- name: Install Sentry CLI
run: curl -sL https://sentry.io/get-cli/ | bash

- name: Install dependencies
run: pnpm install

Expand All @@ -50,3 +53,27 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}

# Add step to create Sentry release and inject source maps
- name: Sentry inject source maps
run: |
# Get version from CLI package.json
CLI_VERSION=$(node -p "require('./apps/cli/package.json').version")
# Set as environment variable for subsequent steps
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
# Inject source maps for the CLI app
sentry-cli sourcemaps inject ./apps/cli/dist
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# SENTRY_URL: https://sentry.io/
with:
environment: production
version: ${{ env.CLI_VERSION }}
sourcemaps: './apps/cli/dist'
1 change: 0 additions & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@repo/base": "workspace:*",
"@repo/ioloc": "workspace:*",
"@repo/translate": "workspace:*",
"@sentry/esbuild-plugin": "^2.22.7",
"@sentry/node": "^8.47.0",
"chalk": "^5.3.0",
"yargs": "^17.7.2"
Expand Down
1 change: 1 addition & 0 deletions apps/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { commands } from './commands/index.js';
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: version,
tracesSampleRate: 1.0, // Capture 100% of the transactions
});
}
Expand Down
10 changes: 0 additions & 10 deletions apps/cli/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { sentryEsbuildPlugin } from '@sentry/esbuild-plugin';
import { defineConfig } from 'tsup';

export default defineConfig({
Expand All @@ -13,13 +12,4 @@ export default defineConfig({
env: {
SENTRY_DSN: process.env.SENTRY_DSN || '',
},
esbuildPlugins: [
// Put the Sentry esbuild plugin after all other plugins
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
telemetry: false,
}),
],
});
Loading

0 comments on commit 0697b04

Please sign in to comment.