aboutsummaryrefslogtreecommitdiffstats
path: root/development/sentry-publish.js
diff options
context:
space:
mode:
authornyatla <nyatla39@gmail.com>2018-04-10 16:14:28 +0800
committernyatla <nyatla39@gmail.com>2018-04-10 16:14:28 +0800
commitcc246528b509b80e560715f3b315acf0764e99e7 (patch)
treea04cc12e6c11345bf751726f15fa9d3dd6be4733 /development/sentry-publish.js
parentbc0487006c623f1c81c186ba5b2a7137efb940ec (diff)
parentb91bd818c7c2aec2952036a2f69ab05e0690a06e (diff)
downloadtangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.tar.gz
tangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.tar.zst
tangerine-wallet-browser-cc246528b509b80e560715f3b315acf0764e99e7.zip
Merge tag 'v4.5.5'
# Conflicts: # app/_locales/ja/messages.json # package-lock.json messages.jsonのローカライズ
Diffstat (limited to 'development/sentry-publish.js')
-rw-r--r--development/sentry-publish.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/development/sentry-publish.js b/development/sentry-publish.js
new file mode 100644
index 000000000..ab3acabbd
--- /dev/null
+++ b/development/sentry-publish.js
@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+const pify = require('pify')
+const exec = pify(require('child_process').exec, { multiArgs: true })
+const VERSION = require('../dist/chrome/manifest.json').version
+
+start().catch(console.error)
+
+async function start(){
+ const authWorked = await checkIfAuthWorks()
+ if (!authWorked) {
+ console.log(`Sentry auth failed...`)
+ }
+ // check if version exists or not
+ const versionAlreadyExists = await checkIfVersionExists()
+ // abort if versions exists
+ if (versionAlreadyExists) {
+ console.log(`Version "${VERSION}" already exists on Sentry, aborting sourcemap upload.`)
+ return
+ }
+
+ // create sentry release
+ console.log(`creating Sentry release for "${VERSION}"...`)
+ await exec(`sentry-cli releases --org 'metamask' --project 'metamask' new ${VERSION}`)
+ console.log(`removing any existing files from Sentry release "${VERSION}"...`)
+ await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} delete --all`)
+ // upload sentry source and sourcemaps
+ console.log(`uploading source files Sentry release "${VERSION}"...`)
+ await exec(`for FILEPATH in ./dist/chrome/*.js; do [ -e $FILEPATH ] || continue; export FILE=\`basename $FILEPATH\` && echo uploading $FILE && sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload $FILEPATH metamask/$FILE; done;`)
+ console.log(`uploading sourcemaps Sentry release "${VERSION}"...`)
+ await exec(`sentry-cli releases --org 'metamask' --project 'metamask' files ${VERSION} upload-sourcemaps ./dist/sourcemaps/ --url-prefix 'sourcemaps'`)
+ console.log('all done!')
+}
+
+async function checkIfAuthWorks() {
+ const itWorked = await doesNotFail(async () => {
+ await exec(`sentry-cli releases --org 'metamask' --project 'metamask' list`)
+ })
+ return itWorked
+}
+
+async function checkIfVersionExists() {
+ const versionAlreadyExists = await doesNotFail(async () => {
+ await exec(`sentry-cli releases --org 'metamask' --project 'metamask' info ${VERSION}`)
+ })
+ return versionAlreadyExists
+}
+
+async function doesNotFail(asyncFn) {
+ try {
+ await asyncFn()
+ return true
+ } catch (err) {
+ return false
+ }
+}