adds 'projects' option

This commit is contained in:
Stephen Cefali
2020-11-05 09:24:01 -08:00
parent 8b4c4d15f4
commit 9ff660a209
5 changed files with 35 additions and 8 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.4",
"@sentry/cli": "^1.55.0",
"@sentry/cli": "^1.59.0",
"@sentry/types": "^5.17.0"
},
"devDependencies": {
+13 -2
View File
@@ -13,11 +13,12 @@ import * as validate from './validate';
const shouldFinalize = validate.getShouldFinalize();
const deployStartedAtOption = validate.getStartedAt();
const setCommitsOption = validate.getSetCommitsOption();
const projects = validate.getProjects();
const version = await validate.getVersion();
core.debug(`Version is ${version}`);
await cli.new(version);
await cli.new(version, {projects});
if (setCommitsOption !== 'skip') {
core.debug(`Setting commits with option '${setCommitsOption}'`);
@@ -26,7 +27,17 @@ import * as validate from './validate';
if (sourcemaps) {
core.debug(`Adding sourcemaps`);
await cli.uploadSourceMaps(version, {include: sourcemaps});
await Promise.all(
projects.map(async project => {
// upload source maps can only do one project at a time
const localProjects: [string] = [project];
const sourceMapOptions = {
include: sourcemaps,
projects: localProjects,
};
return cli.uploadSourceMaps(version, sourceMapOptions);
})
);
}
core.debug(`Adding deploy to release`);
+2 -1
View File
@@ -1,7 +1,7 @@
declare module '@sentry/cli' {
export class Releases {
constructor(configFile?: string, options?: {silent?: boolean});
new(release: string): Promise<void>;
new(release: string, options?: {projects: string[]}): Promise<void>;
setCommits(
release: string,
options: {
@@ -27,6 +27,7 @@ declare module '@sentry/cli' {
urlPrefix?: string;
urlSuffix?: string;
ext?: string[];
projects?: [string]; //only one project allowed (for now)
}
): Promise<void>;
listDeploys(release: string): Promise<string[]>;
+15
View File
@@ -142,3 +142,18 @@ export const checkEnvironmentVariables = (): void => {
);
}
};
export const getProjects = (): string[] => {
const projectsOption = core.getInput('projects') || '';
const projects = projectsOption.split(',').map(proj => proj.trim());
if (projects.length > 0) {
return projects;
}
const project = process.env['SENTRY_PROJECT'];
if (!project) {
throw Error(
'Environment variable SENTRY_PROJECT is missing a project slug and no projects are specified with the "projects" option'
);
}
return [project];
};
+4 -4
View File
@@ -469,10 +469,10 @@
"@types/yargs" "^15.0.0"
chalk "^4.0.0"
"@sentry/cli@^1.55.0":
version "1.55.0"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.55.0.tgz#0da95cd9491e11da52b15796bded72480f69591b"
integrity sha512-LOpM69Kvfaossq92wgP8cg3+0XBc9lg76udH4OdmpSZhtavS/qxWedBsnTicaT//7rQUNZBUnTPOpmCYnpGEIA==
"@sentry/cli@^1.59.0":
version "1.59.0"
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.59.0.tgz#8154c6426a105c6c8a2437db085837aff8e29834"
integrity sha512-9nK4uVHW7HIbOwFZNvHRWFJcD+bqjW3kMWK2UUMqQWse0Lf3xM+2o+REGGkk0S69+E4elSiukVjUPTI5aijNlA==
dependencies:
https-proxy-agent "^5.0.0"
mkdirp "^0.5.5"