From e8523067b03d84b111f1955d20d786fdf05aae43 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Wed, 22 Sep 2021 06:17:57 -0400 Subject: [PATCH] [MM-37055] Remove commit hash from release builds generated by CircleCI (#1750) --- src/main/CriticalErrorHandler.ts | 2 +- src/main/menus/app.ts | 2 +- src/renderer/index.tsx | 2 +- webpack.config.base.js | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/CriticalErrorHandler.ts b/src/main/CriticalErrorHandler.ts index 0c3a463d..a6bb0567 100644 --- a/src/main/CriticalErrorHandler.ts +++ b/src/main/CriticalErrorHandler.ts @@ -19,7 +19,7 @@ function createErrorReport(err: Error) { // eslint-disable-next-line no-undef // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - return `Application: ${app.name} ${app.getVersion()} [commit: ${__HASH_VERSION__}]\n` + + return `Application: ${app.name} ${app.getVersion()}${__HASH_VERSION__ ? ` [commit: ${__HASH_VERSION__}]` : ''}\n` + `Platform: ${os.type()} ${os.release()} ${os.arch()}\n` + `${err.stack}`; } diff --git a/src/main/menus/app.ts b/src/main/menus/app.ts index 440ec769..b2bd8e26 100644 --- a/src/main/menus/app.ts +++ b/src/main/menus/app.ts @@ -265,7 +265,7 @@ function createTemplate(config: Config) { // eslint-disable-next-line no-undef // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - label: `Version ${app.getVersion()} commit: ${__HASH_VERSION__}`, + label: `Version ${app.getVersion()}${__HASH_VERSION__ ? ` commit: ${__HASH_VERSION__}` : ''}`, enabled: false, }); diff --git a/src/renderer/index.tsx b/src/renderer/index.tsx index cd665950..3cb2c773 100644 --- a/src/renderer/index.tsx +++ b/src/renderer/index.tsx @@ -136,7 +136,7 @@ window.ipcRenderer.invoke('get-app-version').then(({name, version}) => { // eslint-disable-next-line no-undef // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - console.log(`Starting ${name} v${version} commit: ${__HASH_VERSION__}`); + console.log(`Starting ${name} v${version}${__HASH_VERSION__ ? ` commit: ${__HASH_VERSION__}` : ''}`); }); ReactDOM.render( diff --git a/webpack.config.base.js b/webpack.config.base.js index f18b46ba..c0d1d7c6 100644 --- a/webpack.config.base.js +++ b/webpack.config.base.js @@ -14,9 +14,10 @@ const path = require('path'); const VERSION = childProcess.execSync('git rev-parse --short HEAD').toString(); const isProduction = process.env.NODE_ENV === 'production'; +const isRelease = process.env.CIRCLE_BRANCH && process.env.CIRCLE_BRANCH.startsWith('release-'); const codeDefinitions = { - __HASH_VERSION__: JSON.stringify(VERSION), + __HASH_VERSION__: !isRelease && JSON.stringify(VERSION), }; codeDefinitions['process.env.NODE_ENV'] = JSON.stringify(process.env.NODE_ENV);