Skip to content

Commit d61e27f

Browse files
feat(action-release): Add more details for the Sentry Release GitHub action (#12403)
* feat(action-release): Add more details for the Sentry Release GitHub action * Add prerequisites and simplify `inject` description * Update docs/product/releases/setup/release-automation/github-actions/index.mdx Co-authored-by: Steven Eubank <[email protected]> * Update docs/product/releases/setup/release-automation/github-actions/index.mdx Co-authored-by: Steven Eubank <[email protected]> * Add guide and screenshot to github repository secrets * Clarify warning of when the action should be running --------- Co-authored-by: Steven Eubank <[email protected]>
1 parent ec76729 commit d61e27f

File tree

2 files changed

+76
-6
lines changed

2 files changed

+76
-6
lines changed
311 KB
Loading
Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,84 @@
11
---
22
title: GitHub Actions
3-
description: "Learn how Sentry and GitHub Actions automate release management and help identify suspect commits."
3+
description: "Learn how Sentry and GitHub Actions automate release management, upload source maps and help identify suspect commits."
44
---
55

6-
<Alert level="warning">
6+
The [Sentry Release GitHub Action](https://github.com/marketplace/actions/sentry-release) 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.
77

8-
If you make changes to your organization slug, you'll need to update your configuration for this integration. Learn more in our [troubleshooting guide](/organization/integrations/troubleshooting).
8+
For more details about Sentry release management concepts, see the full documentation on [releases](/product/releases/).
99

10-
</Alert>
10+
## Prerequisites
1111

12-
The [Sentry Release GitHub Action](https://github.com/marketplace/actions/sentry-release) automates Sentry release management in GitHub with just one step. After sending Sentry release information, youll be able to associate commits with releases. Additionally, releases are used for applying source maps to view original, untransformed source code.
12+
For the Sentry Release GitHub action to communicate securely with Sentry, you'll need to configure an [Organization Auth Token](https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/).
1313

14-
For more details about Sentry release management concepts, see the full documentation on [releases](/product/releases/).
14+
15+
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`.
16+
17+
<OrgAuthTokenNote />
18+
19+
```bash
20+
SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
21+
SENTRY_ORG=___ORG_SLUG___
22+
SENTRY_PROJECT=___PROJECT_SLUG___
23+
# For self-hosted
24+
# SENTRY_URL=https://my-sentry-url
25+
```
26+
27+
We recommend storing these as [encrypted secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) on your repository.
28+
29+
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`**.
30+
31+
![Adding encrypted repository secrets on GitHub](../../../img/github_secrets.png)
32+
33+
## Releases
34+
35+
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.
36+
37+
```yml
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Create Sentry release
43+
uses: getsentry/action-release@v1
44+
env:
45+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
46+
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
47+
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
48+
with:
49+
environment: production
50+
version: 'v1.3.4'
51+
```
52+
53+
## Source Maps
54+
55+
If your application is written in JavaScript you probably deploy minified application code. To enable readable
56+
stack traces in your Sentry errors, you need to upload source maps to Sentry.
57+
58+
Provide the path(s) to your source maps via the `sourcemaps` option and set the `inject` flag to allow the GitHub
59+
action to inject information into your source files and source maps to ensure proper un-minification of your stack traces.
60+
Visit [What are Artifact Bundles](/platforms/javascript/sourcemaps/troubleshooting_js/artifact-bundles/) if you want to learn more.
61+
62+
```yml
63+
- uses: actions/checkout@v4
64+
with:
65+
fetch-depth: 0
66+
67+
- name: Create Sentry release
68+
uses: getsentry/action-release@v1
69+
env:
70+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
71+
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
72+
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
73+
with:
74+
environment: production
75+
inject: true
76+
sourcemaps: './dist'
77+
```
78+
79+
<Alert>
80+
81+
It's important the Sentry Release GitHub Actions runs after any build steps in your pipeline but before deployment and
82+
to deploy the files that have been built after the action runs so that Sentry can properly un-minify stack traces for you.
83+
84+
</Alert>

0 commit comments

Comments
 (0)