Adding Sentry Releases and Sourcemaps to GitHub Actions
Create a Sentry release and upload sourcemaps in CI so errors show real stack traces.
Minified production code makes Sentry stack traces unreadable unless you upload sourcemaps and tie them to a release. The getsentry/action-release wraps sentry-cli to create the release, associate commits, and upload sourcemaps in one step.
What you need
- SENTRY_AUTH_TOKEN, SENTRY_ORG, and SENTRY_PROJECT.
- A production build that emits sourcemaps.
- The getsentry/action-release.
The workflow
Build with sourcemaps, then create the release and upload them.
.github/workflows/release.yml
- run: npm ci && npm run build
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
sourcemaps: ./dist
version: ${{ github.sha }}Common gotchas
- The release version in CI must match the release reported by your app at runtime.
- Strip or do not publicly serve sourcemaps after upload if you want to keep source private.
- Sourcemaps must exist at build time - confirm your bundler emits them.
Key takeaways
- getsentry/action-release creates the release and uploads sourcemaps.
- The CI release version must match the app runtime version.
- Ensure your build actually emits sourcemaps.
Related guides
Adding Datadog CI Visibility to GitHub ActionsSend pipeline and test data to Datadog CI Visibility from GitHub Actions using datadog-ci, with an API key an…
Publishing a Docker Image to GHCR from GitHub ActionsBuild and push a Docker image to GitHub Container Registry from GitHub Actions with Buildx, login, metadata t…
Adding semantic-release to GitHub ActionsAutomate versioning and publishing with semantic-release in GitHub Actions: derive the version from commits,…