Automatically create a Sentry release in a workflow. Also for on-premise instances.
A release is a version of your code that is 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.
For this action to communicate securely with Sentry, you'll need to create a new internal integration. In Sentry, navigate to: Settings > Developer Settings > New Internal Integration.
Give your new integration a name (for example, "GitHub Action Release Integration”) and specify the necessary permissions. In this case, we need Admin access for “Release” and Read access for “Organization”.
Click “Save” at the bottom of the page and grab your token, which you’ll use as your SENTRY_AUTH_TOKEN
. We recommend you store this as an encrypted secret.
Adding the following to your workflow will create a new Sentry release and tell Sentry that you are deploying to the production
environment.
- uses: actions/checkout@v2
- name: Create Sentry release
uses: lasalefamine/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
with:
environment: production
The following are all required.
name | description |
---|---|
SENTRY_AUTH_TOKEN |
Authentication token for Sentry. See installation. |
SENTRY_ORG |
The slug of the organization name in Sentry. |
SENTRY_PROJECT |
The slug of the project name in Sentry. |
SENTRY_URL |
Url for on-premise Sentry. |
name | description | default |
---|---|---|
environment |
Required. Set the environment for this release. E.g. "production" or "staging". | - |
finalize |
When false, omit marking the release as finalized and released. | true |
sourcemaps |
Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps. | - |
started_at |
Unix timestamp of the release start date. Omit for current time. | - |
version |
Identifier that uniquely identifies the releases. Note: the refs/tags/ prefix is automatically stripped when version is github.ref . |
${{ github.sha }} |
version_prefix |
Value prepended to auto-generated version. For example "v". | - |
set_commits |
Specify whether to set commits for the release. Either "auto" or "skip". | "auto" |
-
Create a new Sentry release for the
production
environment and upload JavaScript source maps from the./lib
directory.- uses: lasalefamine/action-release@v1 with: environment: 'production' sourcemaps: './lib'
-
Create a new Sentry release for the
production
environment of your project at versionv1.0.1
.- uses: lasalefamine/action-release@v1 with: environment: 'production' version: 'v1.0.1'
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 checkout your repo with
actions/checkout@v2
. Otherwise it could fail at thepropose-version
step with the message:error: Could not automatically determine release name
See the Contributing Guide.
See the License File.