From c3732075406e371adf3948a921c3193b7fa8430f Mon Sep 17 00:00:00 2001 From: Jeremy Danyow Date: Mon, 4 Nov 2024 07:34:19 +0000 Subject: [PATCH] add inject option #165 --- README.md | 1 + action.yml | 3 +++ src/main.ts | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 2a3a49a7..e8aeff27 100644 --- a/README.md +++ b/README.md @@ -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`._|${{ github.sha }}| diff --git a/action.yml b/action.yml index 89bbe57e..461404a7 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/src/main.ts b/src/main.ts index 2f534c85..4de7e819 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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); @@ -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(