-
Notifications
You must be signed in to change notification settings - Fork 3
/
sentry.js
29 lines (26 loc) · 954 Bytes
/
sentry.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
//https://medium.com/@vshab/create-react-app-and-sentry-cde1f15cbaa
import SentryCli from '@sentry/cli';
import { execSync } from 'node:child_process';
async function createReleaseAndUpload() {
const release = execSync("git log -n 1 --pretty=format:'%h'").toString();
if (!release) {
console.warn('GIT_COMMIT_HASH is not set');
return;
}
const cli = new SentryCli();
try {
console.log('Creating sentry release ' + release);
await cli.releases.new(release);
console.log('Uploading source maps');
await cli.releases.uploadSourceMaps(release, {
include: ['dist/client/assets'],
urlPrefix: '~/tiltaksgjennomforing/assets',
rewrite: false,
});
console.log('Finalizing release');
await cli.releases.finalize(release);
} catch (e) {
console.error('Source maps uploading failed:', e);
}
}
createReleaseAndUpload();