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 Auth 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=sntrys_YOUR_TOKEN_HERE
SENTRY_ORG=example-org
SENTRY_PROJECT=example-project
# 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.

Adding encrypted repository secrets on GitHub

You can create a new Sentry release by setting the version 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@v1
  env:
    SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
    SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
    SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  with:
    environment: production
    version: "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 and set the inject flag to allow the GitHub action to inject information into your source files and source maps to ensure proper un-minification of your stack traces. Visit What are Artifact Bundles if you want to learn more.

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

- 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 }}
  with:
    environment: production
    inject: true
    sourcemaps: "./dist"
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").