-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsentryRelease.js
34 lines (27 loc) · 957 Bytes
/
sentryRelease.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { exec } = require('child_process');
const runCli = cmd =>
new Promise((resolve, reject) => {
const options = { cwd: process.cwd() };
exec(`sentry-cli releases ${cmd.join(' ')}`, options, error => {
if (error) {
reject(error);
} else {
resolve();
}
});
});
const publish = async (pluginConfig, context) => {
const { project, sourcemaps = [] } = pluginConfig;
const { nextRelease } = context;
const version = `${project}@${nextRelease}`;
// create the release
await runCli(['new', '--project', project, version]);
// list source maps to upload
for (const sourcemap of sourcemaps) {
// eslint-disable-next-line no-await-in-loop
await runCli(['files', version, 'upload-sourcemaps', sourcemap]);
}
// finalize the release
await runCli(['finalize', version]);
};
module.exports = { publish };