Automatically create a Sentry release in a workflow.
A release is a version of your code that can be deployed to an environment. When you give Sentry information about your releases, you unlock a number of new features:
- Determine the issues and regressions introduced in a new release
- Predict which commit caused an issue and who is likely responsible
- Resolve issues by including the issue number in your commit message
- Receive email notifications when your code gets deployed
Additionally, releases are used for applying source maps to minified JavaScript to view original, untransformed source code. You can learn more about releases in the releases documentation.
Version 3 is out with improved support for source maps. We highly recommend upgrading to getsentry/action-release@v3.
Please refer to the release page for the latest release notes.
See how to set up the prerequisites for the Action to securely communicate with Sentry.
Adding the following to your workflow will create a new Sentry release and tell Sentry that you are deploying to the production environment.
Important
Make sure you are using at least v3 of actions/checkout with fetch-depth: 0, issues commonly occur with older versions.
- 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 }}
# SENTRY_URL: https://sentry.io/
with:
environment: production| name | description | default |
|---|---|---|
SENTRY_AUTH_TOKEN |
[Required] Authentication token for Sentry. See Prerequisites. | - |
SENTRY_ORG |
[Required] The slug of the organization name in Sentry. | - |
SENTRY_PROJECT |
The slug of the project name in Sentry. One of SENTRY_PROJECT or projects is required. |
- |
SENTRY_URL |
The URL used to connect to Sentry. (Only required for Self-Hosted Sentry) | https://sentry.io/ |
-
Create a new Sentry release for the
productionenvironment, inject Debug IDs into JavaScript source files and source maps and upload them from the./distdirectory.- uses: getsentry/action-release@v3 with: environment: 'production' sourcemaps: './dist'
-
Create a new Sentry release for the
productionenvironment of your project at versionv1.0.1.- uses: getsentry/action-release@v3 with: environment: 'production' release: 'v1.0.1'
-
Create a new Sentry release for Self-Hosted Sentry
- uses: getsentry/action-release@v3 env: SENTRY_URL: https://sentry.example.com/
-
Manually specify the commit range for the release.
- uses: getsentry/action-release@v3 with: set_commits: manual repo: your-org/your-repo commit: ${{ github.sha }} previous_commit: <previous_commit_sha>
See the Contributing Guide.
See the License File
Suggestions and issues can be posted on the repository's issues page.
-
Forgetting to include the required environment variables (
SENTRY_AUTH_TOKEN,SENTRY_ORG, andSENTRY_PROJECT), yields an error that looks like:Environment variable SENTRY_ORG is missing an organization slug -
Building and running this action locally on an unsupported environment yields an error that looks like:
Syntax error: end of file unexpected (expecting ")") -
When adding the action, make sure to first check out your repo with
actions/checkout@v4. Otherwise, it could fail at thepropose-versionstep with the message:```text error: Could not automatically determine release name ``` -
In
actions/checkout@v4the default fetch depth is 1. If you're getting the error message:error: Could not find the SHA of the previous release in the git history. Increase your git clone depth.you can fetch all history for all branches and tags by setting the
fetch-depthto zero like so:- uses: actions/checkout@v4 with: fetch-depth: 0
-
Not finding the repository
Error: Command failed: /action-release/node_modules/@sentry/cli-linux-x64/bin/sentry-cli --header sentry-trace:ab7a03b5cd8ce324103b3ced985de08b-2bf7fecfb8a1e812-1 --header baggage:sentry-environment=production-sentry-github-action,sentry-release=1.10.5,sentry-public_key=<truncated>,sentry-trace_id=ab7a03b5cd8ce324103b3ced985de08b,sentry-sample_rate=1,sentry-transaction=sentry-github-action-execution,sentry-sampled=true releases set-commits action-test --auto error: could not find repository at '.'; class=Repository (6); code=NotFound (-3)Ensure you use
actions/checkoutbefore running the action- uses: actions/checkout@v4 with: fetch-depth: 0 - uses: getsentry/action-release@v3 with: environment: 'production' release: 'v1.0.1'
