Skip to content

Commit 763a194

Browse files
committed
Add script to sentry for marking a release
1 parent 990beb0 commit 763a194

File tree

6 files changed

+40
-11
lines changed

6 files changed

+40
-11
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ commands:
137137
- run:
138138
name: Build Application
139139
command: yarn build:prod
140+
- run:
141+
name: Mark Sentry release
142+
command: |
143+
if [ "${CIRCLE_BRANCH}" == "master" ]; then
144+
node packages/app/scripts/sentry-create-release.js
145+
fi
140146
- save_cache: *save_prod_cache
141147
- run:
142148
name: Remove non-images from public

packages/app/config/webpack.prod.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,11 @@ const normalizeName = require('webpack/lib/optimize/SplitChunksPlugin')
99
.normalizeName;
1010
const ManifestPlugin = require('webpack-manifest-plugin');
1111
const CopyWebpackPlugin = require('copy-webpack-plugin');
12-
const childProcess = require('child_process');
12+
const VERSION = require('@codesandbox/common/lib/version').default;
1313
const commonConfig = require('./webpack.common');
1414

1515
const publicPath = '/';
1616

17-
const COMMIT_COUNT = childProcess
18-
.execSync('git rev-list --count HEAD')
19-
.toString();
20-
21-
const COMMIT_HASH = childProcess
22-
.execSync('git rev-parse --short HEAD')
23-
.toString();
24-
const VERSION = `${COMMIT_COUNT}-${COMMIT_HASH}`;
25-
2617
const normalize = normalizeName({ name: true, automaticNameDelimiter: '~' });
2718

2819
module.exports = merge(commonConfig, {

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@babel/preset-flow": "^7.0.0",
4242
"@babel/preset-react": "^7.0.0",
4343
"@babel/preset-typescript": "^7.3.3",
44+
"@sentry/cli": "^1.47.1",
4445
"@types/codemirror": "^0.0.72",
4546
"@types/debug": "^4.1.1",
4647
"@types/gsap": "^1.20.1",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const childProcess = require('child_process');
2+
const VERSION = require('@codesandbox/common/lib/version').default;
3+
4+
const COMMIT_HASH = childProcess
5+
.execSync('git rev-parse HEAD')
6+
.toString()
7+
.trim();
8+
9+
console.log('Marking this release in Sentry');
10+
try {
11+
childProcess.execSync(
12+
`yarn sentry-cli releases --org=codesandbox -p frontend new "${VERSION}"`
13+
);
14+
childProcess.execSync(
15+
`yarn sentry-cli releases --org=codesandbox set-commits "${VERSION}" --commit "CompuIves/codesandbox-client@${COMMIT_HASH}"`
16+
);
17+
console.log('Marked release');
18+
} catch (e) {
19+
console.error(e);
20+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const childProcess = require('child_process');
2+
const VERSION = require('@codesandbox/common/lib/version').default;
3+
4+
console.log('Marking this release as deployed in Sentry');
5+
try {
6+
childProcess.execSync(
7+
`yarn run sentry-cli releases --org=codesandbox deploys ${VERSION} new -e PROD`
8+
);
9+
} catch (e) {
10+
console.error(e);
11+
}

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3286,7 +3286,7 @@
32863286
"@sentry/utils" "5.6.1"
32873287
tslib "^1.9.3"
32883288

3289-
"@sentry/cli@^1.44.4":
3289+
"@sentry/cli@^1.44.4", "@sentry/cli@^1.47.1":
32903290
version "1.47.1"
32913291
resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.47.1.tgz#6a3238e5bfa4f618867bc0bc145b8e2ba191ff46"
32923292
integrity sha512-WijaRu1lb99OL6rHee6uOSb1wDyNCbrWcTJoRCuZD83K2fw3U58p68nli/y8CoMwQ55Mrg6CgtY8pmBiuseG0A==

0 commit comments

Comments
 (0)