Skip to content

Commit

Permalink
add inject option getsentry#165
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanyow committed Nov 4, 2024
1 parent ccab208 commit c373207
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Adding the following to your workflow will create a new Sentry release and tell
|`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`|
|`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`|
|`sourcemaps`|Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps.|-|
|`inject`|Fixes up JavaScript source files and sourcemaps with debug ids.|`false`|
|`dist`|Unique identifier for the distribution, used to further segment your release. Usually your build number.|-|
|`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`._|<code>${{&nbsp;github.sha&nbsp;}}</code>|
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
sourcemaps:
description: 'Space-separated list of paths to JavaScript sourcemaps. Omit to skip uploading sourcemaps.'
required: false
inject:
description: 'Fixes up JavaScript source files and sourcemaps with debug ids.'
required: false
dist:
description: 'Unique identifier for the distribution, used to further segment your release. Usually your build number.'
required: false
Expand Down
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as process from 'process';
options.checkEnvironmentVariables();

const environment = options.getEnvironment();
const inject = options.getBooleanOption('inject', false);
const sourcemaps = options.getSourcemaps();
const dist = options.getDist();
const shouldFinalize = options.getBooleanOption('finalize', true);
Expand Down Expand Up @@ -44,6 +45,15 @@ import * as process from 'process';
});
}

if (inject) {
if (sourcemaps.length) {
core.debug('Injecting sourcemaps');
await cli.execute(['sourcemaps', 'inject', ...sourcemaps], true);
} else {
core.warning(`Inject was specified without also specifying sourcemaps`);
}
}

if (sourcemaps.length) {
core.debug(`Adding sourcemaps`);
await Promise.all(
Expand Down

0 comments on commit c373207

Please sign in to comment.