GitHub Actions

Learn how Sentry and GitHub Actions automate release management, upload source maps and help identify suspect commits.

The Sentry Release GitHub Action automates Sentry release management in GitHub with just one step. After sending Sentry release information, you’ll be able to associate commits with releases. Additionally, you can upload source maps to view original, un-minified source code.

For more details about Sentry release management concepts, see the full documentation on releases.

For the Sentry Release GitHub action to communicate securely with Sentry, you'll need to configure an Organization Token.

You also need to set your Organization and Project slugs and if you're using a self-hosted Sentry instance, provide the URL used to connect to Sentry via SENTRY_URL.

Copied
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
SENTRY_ORG=___ORG_SLUG___
SENTRY_PROJECT=___PROJECT_SLUG___
# For self-hosted
# SENTRY_URL=https://my-sentry-url

We recommend storing these as encrypted secrets on your repository.

To set repository secrets, click on your repository Settings ①, select Secrets and variables ② from the sidebar and click on Actions ③. Click on the New repository secret ④ and add the secrets SENTRY_AUTH_TOKEN ⑤, SENTRY_ORG ⑥ and SENTRY_PROJECT ⑦.

You can create a new Sentry release by setting the release option. By default, the Sentry Release GitHub action will use the GitHub sha that triggered the GitHub workflow.

Copied
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

- name: Create Sentry release
  uses: getsentry/action-release@v3
  env:
    SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
    SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
    SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  with:
    environment: production
    release: "v1.3.4"

If your application is written in JavaScript you probably deploy minified application code. To enable readable stack traces in your Sentry errors, you need to upload source maps to Sentry.

Provide the path(s) to your source maps via the sourcemaps option to ensure proper un-minification of your stack traces. Visit What are Debug IDs if you want to learn more.

Copied
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

- name: Create Sentry release
  uses: getsentry/action-release@v3
  env:
    SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
    SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
    SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  with:
    environment: production
    sourcemaps: "./dist"
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
How to contribute   |  Edit this page   |  Create a docs issue   |  Get support