Skip to content

Commit e3c368a

Browse files
committed
feat(sourcemaps): Add inject option to inject debug ids into sourcefiles and sourcemaps
1 parent 6dca92a commit e3c368a

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,24 @@ Adding the following to your workflow will create a new Sentry release and tell
6060

6161
#### Parameters
6262

63-
|name|description|default|
64-
|---|---|---|
65-
|`environment`|Set the environment for this release. E.g. "production" or "staging". Omit to skip adding deploy to release.|-|
66-
|`finalize`|When false, omit marking the release as finalized and released.|`true`|
67-
|`ignore_missing`|When the flag is set and the previous release commit was not found in the repository, will create a release with the default commits count instead of failing the command.|`false`|
68-
|`ignore_empty`|When the flag is set, command will not fail and just exit silently if no new commits for a given release have been found.|`false`|
69-
|`sourcemaps`|Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps.|-|
70-
|`dist`|Unique identifier for the distribution, used to further segment your release. Usually your build number.|-|
71-
|`started_at`|Unix timestamp of the release start date. Omit for current time.|-|
72-
|`version`|Identifier that uniquely identifies the releases. _Note: the `refs/tags/` prefix is automatically stripped when `version` is `github.ref`._|<code>${{&nbsp;github.sha&nbsp;}}</code>|
73-
|`version_prefix`|Value prepended to auto-generated version. For example "v".|-|
74-
|`set_commits`|Specify whether to set commits for the release. Either "auto" or "skip".|"auto"|
75-
|`projects`|Space-separated list of paths of projects. When omitted, falls back to the environment variable `SENTRY_PROJECT` to determine the project.|-|
76-
|`url_prefix`|Adds a prefix to source map urls after stripping them.|-|
77-
|`strip_common_prefix`|Will remove a common prefix from uploaded filenames. Useful for removing a path that is build-machine-specific.|`false`|
78-
|`working_directory`|Directory to collect sentry release information from. Useful when collecting information from a non-standard checkout directory.|-|
79-
|`disable_telemetry`|The action sends telemetry data and crash reports to Sentry. This helps us improve the action. You can turn this off by setting this flag.|`false`|
63+
|name| description |default|
64+
|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
65+
|`environment`| Set the environment for this release. E.g. "production" or "staging". Omit to skip adding deploy to release. |-|
66+
|`inject`| Injects Debug IDs into source files and sourcemaps. We **strongly recommend** enabling this to ensure proper un-minifaction of your stacktraces. |`false`|
67+
|`sourcemaps`| Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps. |-|
68+
|`finalize`| When false, omit marking the release as finalized and released. |`true`|
69+
|`ignore_missing`| When the flag is set and the previous release commit was not found in the repository, will create a release with the default commits count instead of failing the command. |`false`|
70+
|`ignore_empty`| When the flag is set, command will not fail and just exit silently if no new commits for a given release have been found. |`false`|
71+
|`dist`| Unique identifier for the distribution, used to further segment your release. Usually your build number. |-|
72+
|`started_at`| Unix timestamp of the release start date. Omit for current time. |-|
73+
|`version`| Identifier that uniquely identifies the releases. _Note: the `refs/tags/` prefix is automatically stripped when `version` is `github.ref`._ |<code>${{&nbsp;github.sha&nbsp;}}</code>|
74+
|`version_prefix`| Value prepended to auto-generated version. For example "v". |-|
75+
|`set_commits`| Specify whether to set commits for the release. Either "auto" or "skip". |"auto"|
76+
|`projects`| Space-separated list of paths of projects. When omitted, falls back to the environment variable `SENTRY_PROJECT` to determine the project. |-|
77+
|`url_prefix`| Adds a prefix to source map urls after stripping them. |-|
78+
|`strip_common_prefix`| Will remove a common prefix from uploaded filenames. Useful for removing a path that is build-machine-specific. |`false`|
79+
|`working_directory`| Directory to collect sentry release information from. Useful when collecting information from a non-standard checkout directory. |-|
80+
|`disable_telemetry`| The action sends telemetry data and crash reports to Sentry. This helps us improve the action. You can turn this off by setting this flag. |`false`|
8081

8182
### Examples
8283

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
environment:
66
description: 'Set the environment for this release. E.g. "production" or "staging". Omit to skip adding deploy to release.'
77
required: false
8+
inject:
9+
description: 'Injects Debug IDs into source files and sourcemaps. We strongly recommend enabling this to ensure proper un-minifaction of your stacktraces.'
10+
required: false
811
sourcemaps:
912
description: 'Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps.'
1013
required: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "action-release",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"private": true,
55
"description": "GitHub Action for creating a release on Sentry",
66
"main": "dist/index.js",

src/main.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ withTelemetry(
2020
options.checkEnvironmentVariables();
2121

2222
const environment = options.getEnvironment();
23+
const inject = options.getBooleanOption('inject', false);
2324
const sourcemaps = options.getSourcemaps();
2425
const dist = options.getDist();
2526
const shouldFinalize = options.getBooleanOption('finalize', true);
@@ -64,8 +65,20 @@ withTelemetry(
6465
}
6566

6667
Sentry.setTag('sourcemaps', sourcemaps.length > 0);
68+
Sentry.setTag('inject', inject);
6769

6870
if (sourcemaps.length) {
71+
if (inject) {
72+
await traceStep('inject-debug-ids', async () => {
73+
core.debug(`Injecting Debug IDs`);
74+
// Unfortunately, @sentry/cli does not yet have an alias for inject
75+
await getCLI().execute(
76+
['sourcemaps', 'inject', ...sourcemaps],
77+
true
78+
);
79+
});
80+
}
81+
6982
await traceStep('upload-sourcemaps', async () => {
7083
core.debug(`Adding sourcemaps`);
7184
await Promise.all(

0 commit comments

Comments
 (0)