feat: url prefix for source maps (#33)

This commit is contained in:
Stephen Cefali
2020-11-16 13:02:28 -08:00
committed by GitHub
parent 2998d15736
commit 250b34ea71
5 changed files with 20 additions and 2 deletions
+2
View File
@@ -53,6 +53,8 @@ The following are all _required_.
|`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>|
|`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"|
|`projects`|Space-separated list of paths of projects. When omitted, falls back to the environment variable `SENTRY_PROJECT` to determine the project.|-|
|`url_prefix`|Adds a prefix to source map urls after stripping them.|-|
### Examples
- Create a new Sentry release for the `production` environment and upload JavaScript source maps from the `./lib` directory.
+10
View File
@@ -8,6 +8,7 @@ import {
getVersion,
getSetCommitsOption,
getProjects,
getUrlPrefixOption,
} from '../src/validate';
describe('validate', () => {
@@ -160,6 +161,15 @@ describe('validate', () => {
);
});
});
describe('getUrlPrefixOption', () => {
afterEach(() => {
delete process.env['URL_PREFIX'];
});
it('get url prefix', () => {
process.env['INPUT_URL_PREFIX'] = 'build';
expect(getUrlPrefixOption()).toEqual('build');
})
})
});
// shows how the runner will run a javascript action with env / stdout protocol
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "action-release",
"version": "1.1.2",
"version": "1.1.3",
"private": true,
"description": "GitHub Action for creating a release on Sentry",
"main": "dist/index.js",
+3 -1
View File
@@ -14,6 +14,7 @@ import * as validate from './validate';
const deployStartedAtOption = validate.getStartedAt();
const setCommitsOption = validate.getSetCommitsOption();
const projects = validate.getProjects();
const urlPrefix = validate.getUrlPrefixOption();
const version = await validate.getVersion();
@@ -25,7 +26,7 @@ import * as validate from './validate';
await cli.setCommits(version, {auto: true});
}
if (sourcemaps) {
if (sourcemaps.length) {
core.debug(`Adding sourcemaps`);
await Promise.all(
projects.map(async project => {
@@ -34,6 +35,7 @@ import * as validate from './validate';
const sourceMapOptions = {
include: sourcemaps,
projects: localProjects,
urlPrefix,
};
return cli.uploadSourceMaps(version, sourceMapOptions);
})
+4
View File
@@ -155,3 +155,7 @@ export const getProjects = (): string[] => {
}
return [project];
};
export const getUrlPrefixOption = (): string => {
return core.getInput('url_prefix');
}