From a5b685e286f9fb9bf76b5effff58646358ccd0c5 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 11:08:44 +0200 Subject: [PATCH 01/22] Provide apple credential env vars to mac-builder workflow --- .github/workflows/build-electron-app.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 0f07009b..166ba785 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -141,6 +141,11 @@ jobs: uses: nick-fields/retry@v2 continue-on-error: false env: + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} + CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ELECTRON_CACHE: ~/Library/Caches/electron with: From 83bda1e752a70e161d77efbfd0db13c78225d445 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 11:09:51 +0200 Subject: [PATCH 02/22] Add apple credential env vars to .env file --- .env.example | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.env.example b/.env.example index ea127aaf..55ba52c3 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,9 @@ IS_DEV_ENV=0 IS_AUTO_UPDATE_DISABLED=0 EP_GH_IGNORE_TIME=true GH_TOKEN= + +APPLE_TEAM_ID= +APPLE_ID= +APPLE_APP_SPECIFIC_PASSWORD= +CSC_LINK= +CSC_KEY_PASSWORD= From 6699674fd1846fb4700aab84b665a004dcbcf211 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 11:40:13 +0200 Subject: [PATCH 03/22] Add required apple app sandbox entitlements --- build/entitlements.mac.plist | 10 ++++++++++ build/entitlements.mas.inherit.plist | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist index 34d93599..5a5f39bc 100644 --- a/build/entitlements.mac.plist +++ b/build/entitlements.mac.plist @@ -4,6 +4,8 @@ com.apple.security.app-sandbox + com.apple.security.inherit + com.apple.security.network.client com.apple.security.network.server @@ -22,5 +24,13 @@ com.apple.security.cs.disable-library-validation + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.cs.debugger + + com.apple.security.automation.apple-events + diff --git a/build/entitlements.mas.inherit.plist b/build/entitlements.mas.inherit.plist index 4b8d65fa..5a5f39bc 100644 --- a/build/entitlements.mas.inherit.plist +++ b/build/entitlements.mas.inherit.plist @@ -24,5 +24,13 @@ com.apple.security.cs.disable-library-validation + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.cs.debugger + + com.apple.security.automation.apple-events + From 6a5c610e963d60fd6d9b1d6973c80be3fd4b8d8a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 12:25:01 +0200 Subject: [PATCH 04/22] Add mac dmg target release --- electron-builder-config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electron-builder-config.js b/electron-builder-config.js index 64d7ae71..9d00f7ef 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -92,16 +92,19 @@ module.exports = { verifyUpdateCodeSignature: false }, mac: { - type: 'development', hardenedRuntime: true, gatekeeperAssess: false, entitlements: 'build/entitlements.mac.plist', entitlementsInherit: 'build/entitlements.mas.inherit.plist', category: 'public.app-category.finance', target: [ - 'dir' + 'dir', + 'dmg' ] }, + dmg: { + sign: false + }, files: [ '**/*', 'build/icons', From 2febf24c59e7843f649361e341ab0e9814e778a7 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 12:26:03 +0200 Subject: [PATCH 05/22] Set mac type opt as distribution --- electron-builder-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron-builder-config.js b/electron-builder-config.js index 9d00f7ef..d3dc0b59 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -92,6 +92,7 @@ module.exports = { verifyUpdateCodeSignature: false }, mac: { + type: 'distribution', hardenedRuntime: true, gatekeeperAssess: false, entitlements: 'build/entitlements.mac.plist', From e4a156712f525ca6b7fc3f778947c509e171cd5c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 12:27:04 +0200 Subject: [PATCH 06/22] Enable dark mode support for mac --- electron-builder-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron-builder-config.js b/electron-builder-config.js index d3dc0b59..562d7f02 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -98,6 +98,7 @@ module.exports = { entitlements: 'build/entitlements.mac.plist', entitlementsInherit: 'build/entitlements.mas.inherit.plist', category: 'public.app-category.finance', + darkModeSupport: true, target: [ 'dir', 'dmg' From b323193305d413e3dfd9ead9be22f28e68b16d1e Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 12:28:09 +0200 Subject: [PATCH 07/22] Hardcode 11 minimum system version for mac --- electron-builder-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron-builder-config.js b/electron-builder-config.js index 562d7f02..60526728 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -98,6 +98,7 @@ module.exports = { entitlements: 'build/entitlements.mac.plist', entitlementsInherit: 'build/entitlements.mas.inherit.plist', category: 'public.app-category.finance', + minimumSystemVersion: '11', darkModeSupport: true, target: [ 'dir', From 5931d6edc703652290eed59b4ebd8c7ddcfcebf5 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 14 Nov 2023 12:34:10 +0200 Subject: [PATCH 08/22] Add ability to set teamId from env var --- electron-builder-config.js | 4 ++++ package.json | 1 + 2 files changed, 5 insertions(+) diff --git a/electron-builder-config.js b/electron-builder-config.js index 60526728..0fb4b4f0 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -1,5 +1,6 @@ 'use strict' +require('dotenv').config() const fs = require('fs') const path = require('path') const zlib = require('zlib') @@ -100,6 +101,9 @@ module.exports = { category: 'public.app-category.finance', minimumSystemVersion: '11', darkModeSupport: true, + notarize: { + teamId: process.env.APPLE_TEAM_ID + }, target: [ 'dir', 'dmg' diff --git a/package.json b/package.json index 84509832..f06c716f 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@wdio/spec-reporter": "8.21.0", "app-builder-bin": "4.2.0", "cross-env": "7.0.3", + "dotenv": "16.3.1", "electron": "27.2.0", "electron-builder": "24.10.0", "mocha": "10.2.0", From fa19678df024007f7d7097a72c20a680ae6d314a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 9 Jan 2024 13:00:42 +0200 Subject: [PATCH 09/22] Add ability to turn off notarizing --- .env.example | 1 + .github/workflows/build-electron-app.yml | 26 +++++++++++++++----- electron-builder-config.js | 31 ++++++++++++++++++++---- 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/.env.example b/.env.example index 55ba52c3..9f778853 100644 --- a/.env.example +++ b/.env.example @@ -5,6 +5,7 @@ IS_AUTO_UPDATE_DISABLED=0 EP_GH_IGNORE_TIME=true GH_TOKEN= +NOTARIZE=0 APPLE_TEAM_ID= APPLE_ID= APPLE_APP_SPECIFIC_PASSWORD= diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 166ba785..1088ccdb 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -19,6 +19,9 @@ on: isBfxApiStaging: description: 'Is it necessary to use BFX API Staging? (true / 1)?' required: false + isNotarizeDisabled: + description: 'Is notarize disabled (true / 1)?' + required: false env: DOCKER_BUILDKIT: 1 @@ -118,6 +121,10 @@ jobs: name: Turn off auto-update run: | echo "IS_AUTO_UPDATE_DISABLED=1" >> $GITHUB_ENV + - if: ${{ !contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isNotarizeDisabled) }} + name: Turn on notarize + run: | + echo "NOTARIZE=1" >> $GITHUB_ENV - if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isBfxApiStaging) name: Use BFX API Staging for queries run: | @@ -141,11 +148,11 @@ jobs: uses: nick-fields/retry@v2 continue-on-error: false env: - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} - CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.BFX_APPLE_TEAM_ID }} + APPLE_ID: ${{ secrets.BFX_APPLE_ID_USERNAME }} + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.BFX_APPLE_ID_REPORT_PASSWORD }} + CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }} + CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ELECTRON_CACHE: ~/Library/Caches/electron with: @@ -153,7 +160,14 @@ jobs: retry_wait_seconds: 10 max_attempts: 3 retry_on: any - command: ./scripts/build-release.sh -mp + command: | + if [[ -z "${APPLE_TEAM_ID}" ]]; then unset NOTARIZE; fi + if [[ -z "${APPLE_TEAM_ID}" ]]; then unset APPLE_TEAM_ID; fi + if [[ -z "${APPLE_ID}" ]]; then unset APPLE_ID; fi + if [[ -z "${APPLE_APP_SPECIFIC_PASSWORD}" ]]; then unset APPLE_APP_SPECIFIC_PASSWORD; fi + if [[ -z "${CSC_LINK}" ]]; then unset CSC_LINK; fi + if [[ -z "${CSC_KEY_PASSWORD}" ]]; then unset CSC_KEY_PASSWORD; fi + ./scripts/build-release.sh -mp - name: Zip Mac Unpacked build run: zip -r dist/mac.zip dist/mac - name: Upload Mac Unpacked build diff --git a/electron-builder-config.js b/electron-builder-config.js index 0fb4b4f0..64230731 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -8,10 +8,31 @@ const { promisify } = require('util') const archiver = require('archiver') const exec = promisify(require('child_process').exec) +const parseEnvValToBool = require( + './src/helpers/parse-env-val-to-bool' +) + let version let zippedAppImageArtifactPath let zippedMacArtifactPath const appOutDirs = new Map() +const isNotarize = parseEnvValToBool(process.env.NOTARIZE) + +// Notarize can be done only on MacOS +const macNotarize = ( + process.platform === 'darwin' && + isNotarize +) + ? { + notarize: { + teamId: process.env.APPLE_TEAM_ID + } + } + : {} +// DMG can be built only on MacOS +const macSpecificTargets = process.platform === 'darwin' + ? ['dmg'] + : [] /* eslint-disable no-template-curly-in-string */ @@ -101,16 +122,16 @@ module.exports = { category: 'public.app-category.finance', minimumSystemVersion: '11', darkModeSupport: true, - notarize: { - teamId: process.env.APPLE_TEAM_ID - }, + ...macNotarize, target: [ 'dir', - 'dmg' + ...macSpecificTargets ] }, dmg: { - sign: false + // TODO: Need to check + // https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application + // sign: !isNotarize }, files: [ '**/*', From e735d35cada4a9784157380d5f45596f590f2747 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 9 Jan 2024 16:54:56 +0200 Subject: [PATCH 10/22] Imprive parsing env val to bool --- src/helpers/parse-env-val-to-bool.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/helpers/parse-env-val-to-bool.js b/src/helpers/parse-env-val-to-bool.js index 2b2f4359..f0d3c663 100644 --- a/src/helpers/parse-env-val-to-bool.js +++ b/src/helpers/parse-env-val-to-bool.js @@ -4,6 +4,9 @@ module.exports = (value) => { if (typeof value === 'boolean') { return value } + if (!value) { + return false + } const normalizedValue = value.toString() .trim() From c9fe9c7cc8c888ec35a0e669c65f1a2bd67ec6c9 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 10 Jan 2024 09:22:08 +0200 Subject: [PATCH 11/22] Turn off apple app sandbox for standard darwin build https://www.electronjs.org/docs/latest/tutorial/mac-app-store-submission-guide#enable-apples-app-sandbox --- build/entitlements.mac.plist | 2 -- build/entitlements.mas.inherit.plist | 2 -- 2 files changed, 4 deletions(-) diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist index 5a5f39bc..b64de357 100644 --- a/build/entitlements.mac.plist +++ b/build/entitlements.mac.plist @@ -2,8 +2,6 @@ - com.apple.security.app-sandbox - com.apple.security.inherit com.apple.security.network.client diff --git a/build/entitlements.mas.inherit.plist b/build/entitlements.mas.inherit.plist index 5a5f39bc..b64de357 100644 --- a/build/entitlements.mas.inherit.plist +++ b/build/entitlements.mas.inherit.plist @@ -2,8 +2,6 @@ - com.apple.security.app-sandbox - com.apple.security.inherit com.apple.security.network.client From abb0eb6236074b337b5f56b9839adf5ecabb8f5a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 12 Jan 2024 12:14:59 +0200 Subject: [PATCH 12/22] Add ability to build zip release with native mac tool --- electron-builder-config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electron-builder-config.js b/electron-builder-config.js index 64230731..e24c4700 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -31,7 +31,7 @@ const macNotarize = ( : {} // DMG can be built only on MacOS const macSpecificTargets = process.platform === 'darwin' - ? ['dmg'] + ? ['dmg', 'zip'] : [] /* eslint-disable no-template-curly-in-string */ @@ -252,6 +252,8 @@ module.exports = { ) if ( + // Outside darwin zip release can't be built successfully + process.platform !== 'darwin' && targetPlatform === 'mac' && targetName === 'zip' ) { From c3b39bc20d140f95136b8c038eb46e4b8b02a7e2 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 12 Jan 2024 15:26:25 +0200 Subject: [PATCH 13/22] Fix arch opt for mac build --- electron-builder-config.js | 9 +++++---- scripts/build-release.sh | 4 ++-- scripts/node/generate-mac-zipand-blockmap.js | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/electron-builder-config.js b/electron-builder-config.js index e24c4700..bf7627bb 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -17,6 +17,7 @@ let zippedAppImageArtifactPath let zippedMacArtifactPath const appOutDirs = new Map() const isNotarize = parseEnvValToBool(process.env.NOTARIZE) +const arch = process.env.ARCH ?? 'x64' // Notarize can be done only on MacOS const macNotarize = ( @@ -82,7 +83,7 @@ module.exports = { extends: null, asar: false, productName: 'Bitfinex Report', - artifactName: 'BitfinexReport-${version}-x64-${os}.${ext}', + artifactName: 'BitfinexReport-${version}-' + arch + '-${os}.${ext}', appId: 'com.bitfinex.report', publish: { provider: 'github', @@ -244,11 +245,11 @@ module.exports = { ? 'exe' : targetName const foundAppFilePath = artifactPaths.find((path) => ( - new RegExp(`${targetPlatform}.*${ext}$`, 'i').test(path) + new RegExp(`${arch}.*${targetPlatform}.*${ext}$`, 'i').test(path) )) const appFilePath = foundAppFilePath ?? path.join( outDir, - `BitfinexReport-${version}-x64-${targetPlatform}.${ext}` + `BitfinexReport-${version}-${arch}-${targetPlatform}.${ext}` ) if ( @@ -294,7 +295,7 @@ module.exports = { ) { zippedAppImageArtifactPath = path.join( outDir, - `BitfinexReport-${version}-x64-${targetPlatform}.AppImage.zip` + `BitfinexReport-${version}-${arch}-${targetPlatform}.AppImage.zip` ) await new Promise((resolve, reject) => { try { diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 601317d5..3862083b 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -17,7 +17,7 @@ COLOR_YELLOW=${COLOR_YELLOW:-"\033[33m"} COLOR_BLUE=${COLOR_BLUE:-"\033[34m"} COLOR_NORMAL=${COLOR_NORMAL:-"\033[39m"} -ARCH="x64" +export ARCH=${ARCH:-"x64"} BFX_API_URL="https://api-pub.bitfinex.com" STAGING_BFX_API_URL="https://api.staging.bitfinex.com" @@ -230,7 +230,7 @@ fi rm -rf "$DIST_FOLDER/"*"$targetPlatform"* node "$ROOT/node_modules/.bin/electron-builder" \ - "build" "--$targetPlatform" \ + "build" "--$targetPlatform" "--$ARCH" \ "--config" "$ELECTRON_BUILDER_CONFIG_FILE_PATH" \ $publishOption diff --git a/scripts/node/generate-mac-zipand-blockmap.js b/scripts/node/generate-mac-zipand-blockmap.js index 6af9fd6c..d1966259 100644 --- a/scripts/node/generate-mac-zipand-blockmap.js +++ b/scripts/node/generate-mac-zipand-blockmap.js @@ -2,6 +2,7 @@ 'use strict' +require('dotenv').config() const path = require('path') const { chmodSync } = require('fs') const { @@ -24,7 +25,7 @@ const { version: APP_VERSION } = require(packageJsonPath) -const ARCH = 'x64' +const ARCH = process.env.ARCH ?? 'x64' const APP_NAME = productName.replace(/\s/g, '') const APP_DIST_PATH = path.join(cwd, 'dist') const appReleaseFileName = `${APP_NAME}-${APP_VERSION}-${ARCH}-mac.zip` From c20694c4b0cced43646ef857a25b5f11981466da Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 12 Jan 2024 18:23:39 +0200 Subject: [PATCH 14/22] Increase mac-builder timeout --- .github/workflows/build-electron-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 1088ccdb..5705d2e2 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -99,7 +99,7 @@ jobs: sudo chown -R $(id -u):$(id -g) ~/.cache/electron-builder mac-builder: - timeout-minutes: 90 + timeout-minutes: 150 runs-on: macos-12 steps: - name: Checkout @@ -156,7 +156,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ELECTRON_CACHE: ~/Library/Caches/electron with: - timeout_minutes: 20 + timeout_minutes: 40 retry_wait_seconds: 10 max_attempts: 3 retry_on: any From cad4d3892662d2ef3a011ed8ae09ef0e5fc40284 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 15 Jan 2024 13:27:28 +0200 Subject: [PATCH 15/22] Skip backup file creation on mac when using sed cli If a zero-length extension is given after -i, no backup will be saved https://man.openbsd.org/sed --- .github/workflows/build-electron-app.yml | 8 ++++---- Dockerfile.win-builder | 2 +- scripts/build-release.sh | 10 +++++----- scripts/build-ui.sh | 18 +++++++++--------- scripts/setup.sh | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 5705d2e2..9829fcea 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -38,13 +38,13 @@ jobs: submodules: recursive - name: Set repo owner run: | - sed -i -e \ + sed -i'' -e \ "s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \ "./electron-builder-config.js" - if: github.event.inputs.version != '' name: Set release version run: | - sed -i -e \ + sed -i'' -e \ "s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \ "./package.json" - if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled) @@ -108,13 +108,13 @@ jobs: submodules: recursive - name: Set repo owner run: | - sed -i -e \ + sed -i'' -e \ "s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \ "./electron-builder-config.js" - if: github.event.inputs.version != '' name: Set release version run: | - sed -i -e \ + sed -i'' -e \ "s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \ "./package.json" - if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled) diff --git a/Dockerfile.win-builder b/Dockerfile.win-builder index ee59f7ee..f02c5465 100644 --- a/Dockerfile.win-builder +++ b/Dockerfile.win-builder @@ -10,7 +10,7 @@ COPY ./scripts/helpers/install-nodejs.sh ./scripts/helpers/install-nodejs.sh RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \ # Remove the `Wine` source entry to resolve # the release key expiration issue for `apt-get update` - && sed -i '/Wine/d' /etc/apt/sources.list \ + && sed -i'' '/Wine/d' /etc/apt/sources.list \ && apt-get update -y \ && apt-get install -y --no-install-recommends \ p7zip-full \ diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 3862083b..2229d7d7 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -141,22 +141,22 @@ fi if [ $isDevEnv == 1 ]; then echo -e "\n${COLOR_YELLOW}Developer environment is turned on!${COLOR_NORMAL}" - sed -i -e \ + sed -i'' -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"development\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i -e \ + sed -i'' -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"production\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi if [ $isAutoUpdateDisabled == 1 ]; then echo -e "\n${COLOR_YELLOW}Auto-update is turned off!${COLOR_NORMAL}" - sed -i -e \ + sed -i'' -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": true/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i -e \ + sed -i'' -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": false/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi @@ -186,7 +186,7 @@ cp "$EXPRESS_FOLDER/config/default.json.example" \ echo -e "\n${COLOR_BLUE}Setting backend configs${COLOR_NORMAL}" escapedBfxApiUrl=$(escapeString $bfxApiUrl) -sed -i -e \ +sed -i'' -e \ "s/\"restUrl\": \".*\"/\"restUrl\": \"$escapedBfxApiUrl\"/g" \ "$WORKER_FOLDER/config/service.report.json" diff --git a/scripts/build-ui.sh b/scripts/build-ui.sh index 8c8c00d4..768661cc 100755 --- a/scripts/build-ui.sh +++ b/scripts/build-ui.sh @@ -93,32 +93,32 @@ echo -e "\n${COLOR_BLUE}Setting UI configs${COLOR_NORMAL}" escapedBfxHomeUrl=$(escapeString $bfxHomeUrl) escapedBfxKeyUrl=$(escapeString $bfxKeyUrl) -sed -i -e \ +sed -i'' -e \ "s/HOME_URL: .*,/HOME_URL: \'$escapedBfxHomeUrl\',/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/API_URL: .*,/API_URL: \'http:\/\/${BACKEND_ADDRESS}\/api\',/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/WS_ADDRESS: .*,/WS_ADDRESS: \'ws:\/\/${BACKEND_ADDRESS}\/ws\',/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/KEY_URL: .*,/KEY_URL: \'$escapedBfxKeyUrl\/api\',/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/localExport: false/localExport: true/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/showAuthPage: false/showAuthPage: true/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/showFrameworkMode: false/showFrameworkMode: true/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/hostedFrameworkMode: true/hostedFrameworkMode: false/g" \ "$UI_CONFIGS_FILE" -sed -i -e \ +sed -i'' -e \ "s/isElectronApp: false/isElectronApp: true/g" \ "$UI_CONFIGS_FILE" diff --git a/scripts/setup.sh b/scripts/setup.sh index f8c77105..109cc08e 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -83,22 +83,22 @@ fi if [ $isDevEnv == 1 ]; then echo -e "\n${COLOR_YELLOW}Developer environment is turned on!${COLOR_NORMAL}" - sed -i -e \ + sed -i'' -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"development\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i -e \ + sed -i'' -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"production\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi if [ $isAutoUpdateDisabled == 1 ]; then echo -e "\n${COLOR_YELLOW}Auto-update is turned off!${COLOR_NORMAL}" - sed -i -e \ + sed -i'' -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": true/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i -e \ + sed -i'' -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": false/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi @@ -132,7 +132,7 @@ cp "$EXPRESS_FOLDER/config/default.json.example" \ echo -e "\n${COLOR_BLUE}Setting backend configs${COLOR_NORMAL}" escapedBfxApiUrl=$(escapeString $bfxApiUrl) -sed -i -e \ +sed -i'' -e \ "s/\"restUrl\": \".*\"/\"restUrl\": \"$escapedBfxApiUrl\"/g" \ "$WORKER_FOLDER/config/service.report.json" From eab533179becb0318e5fb42e8fe6c76794e208e3 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 15 Jan 2024 14:25:36 +0200 Subject: [PATCH 16/22] Fix mac release size to exclude cache dir --- .github/workflows/build-electron-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 9829fcea..07fcef4d 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -139,7 +139,7 @@ jobs: cache-name: electron-cache-v1 with: path: | - ~/Library/Caches/electron + ${{ runner.temp }}/.cache/electron key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- @@ -154,7 +154,7 @@ jobs: CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }} CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ELECTRON_CACHE: ~/Library/Caches/electron + ELECTRON_CACHE: ${{ runner.temp }}/.cache/electron with: timeout_minutes: 40 retry_wait_seconds: 10 From e6324f3fa6dce2be3be2026ce575abc130861e86 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 15 Jan 2024 15:44:21 +0200 Subject: [PATCH 17/22] Replace macos sed with gnu sed --- .github/workflows/build-electron-app.yml | 12 ++++++++---- Dockerfile.win-builder | 2 +- scripts/build-release.sh | 10 +++++----- scripts/build-ui.sh | 18 +++++++++--------- scripts/setup.sh | 10 +++++----- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 07fcef4d..7e6b09ff 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -38,13 +38,13 @@ jobs: submodules: recursive - name: Set repo owner run: | - sed -i'' -e \ + sed -i -e \ "s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \ "./electron-builder-config.js" - if: github.event.inputs.version != '' name: Set release version run: | - sed -i'' -e \ + sed -i -e \ "s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \ "./package.json" - if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled) @@ -106,15 +106,19 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + - name: Replace macOS’s sed with GNU’s sed + run: | + brew install gnu-sed + echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH - name: Set repo owner run: | - sed -i'' -e \ + sed -i -e \ "s/owner: '.*'/owner: '${{ github.repository_owner }}'/g" \ "./electron-builder-config.js" - if: github.event.inputs.version != '' name: Set release version run: | - sed -i'' -e \ + sed -i -e \ "s/\"version\": \".*\"/\"version\": \"${{ github.event.inputs.version }}\"/g" \ "./package.json" - if: contains(fromJson('["true", "1", true, 1]'), github.event.inputs.isAutoUpdateDisabled) diff --git a/Dockerfile.win-builder b/Dockerfile.win-builder index f02c5465..ee59f7ee 100644 --- a/Dockerfile.win-builder +++ b/Dockerfile.win-builder @@ -10,7 +10,7 @@ COPY ./scripts/helpers/install-nodejs.sh ./scripts/helpers/install-nodejs.sh RUN ./scripts/helpers/install-nodejs.sh ${NODE_VERSION} \ # Remove the `Wine` source entry to resolve # the release key expiration issue for `apt-get update` - && sed -i'' '/Wine/d' /etc/apt/sources.list \ + && sed -i '/Wine/d' /etc/apt/sources.list \ && apt-get update -y \ && apt-get install -y --no-install-recommends \ p7zip-full \ diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 2229d7d7..3862083b 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -141,22 +141,22 @@ fi if [ $isDevEnv == 1 ]; then echo -e "\n${COLOR_YELLOW}Developer environment is turned on!${COLOR_NORMAL}" - sed -i'' -e \ + sed -i -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"development\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i'' -e \ + sed -i -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"production\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi if [ $isAutoUpdateDisabled == 1 ]; then echo -e "\n${COLOR_YELLOW}Auto-update is turned off!${COLOR_NORMAL}" - sed -i'' -e \ + sed -i -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": true/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i'' -e \ + sed -i -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": false/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi @@ -186,7 +186,7 @@ cp "$EXPRESS_FOLDER/config/default.json.example" \ echo -e "\n${COLOR_BLUE}Setting backend configs${COLOR_NORMAL}" escapedBfxApiUrl=$(escapeString $bfxApiUrl) -sed -i'' -e \ +sed -i -e \ "s/\"restUrl\": \".*\"/\"restUrl\": \"$escapedBfxApiUrl\"/g" \ "$WORKER_FOLDER/config/service.report.json" diff --git a/scripts/build-ui.sh b/scripts/build-ui.sh index 768661cc..8c8c00d4 100755 --- a/scripts/build-ui.sh +++ b/scripts/build-ui.sh @@ -93,32 +93,32 @@ echo -e "\n${COLOR_BLUE}Setting UI configs${COLOR_NORMAL}" escapedBfxHomeUrl=$(escapeString $bfxHomeUrl) escapedBfxKeyUrl=$(escapeString $bfxKeyUrl) -sed -i'' -e \ +sed -i -e \ "s/HOME_URL: .*,/HOME_URL: \'$escapedBfxHomeUrl\',/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/API_URL: .*,/API_URL: \'http:\/\/${BACKEND_ADDRESS}\/api\',/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/WS_ADDRESS: .*,/WS_ADDRESS: \'ws:\/\/${BACKEND_ADDRESS}\/ws\',/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/KEY_URL: .*,/KEY_URL: \'$escapedBfxKeyUrl\/api\',/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/localExport: false/localExport: true/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/showAuthPage: false/showAuthPage: true/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/showFrameworkMode: false/showFrameworkMode: true/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/hostedFrameworkMode: true/hostedFrameworkMode: false/g" \ "$UI_CONFIGS_FILE" -sed -i'' -e \ +sed -i -e \ "s/isElectronApp: false/isElectronApp: true/g" \ "$UI_CONFIGS_FILE" diff --git a/scripts/setup.sh b/scripts/setup.sh index 109cc08e..f8c77105 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -83,22 +83,22 @@ fi if [ $isDevEnv == 1 ]; then echo -e "\n${COLOR_YELLOW}Developer environment is turned on!${COLOR_NORMAL}" - sed -i'' -e \ + sed -i -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"development\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i'' -e \ + sed -i -e \ "s/\"NODE_ENV\": \".*\"/\"NODE_ENV\": \"production\"/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi if [ $isAutoUpdateDisabled == 1 ]; then echo -e "\n${COLOR_YELLOW}Auto-update is turned off!${COLOR_NORMAL}" - sed -i'' -e \ + sed -i -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": true/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" else - sed -i'' -e \ + sed -i -e \ "s/\"IS_AUTO_UPDATE_DISABLED\": .*/\"IS_AUTO_UPDATE_DISABLED\": false/g" \ "$ROOT/$ELECTRON_ENV_FILE_NAME" fi @@ -132,7 +132,7 @@ cp "$EXPRESS_FOLDER/config/default.json.example" \ echo -e "\n${COLOR_BLUE}Setting backend configs${COLOR_NORMAL}" escapedBfxApiUrl=$(escapeString $bfxApiUrl) -sed -i'' -e \ +sed -i -e \ "s/\"restUrl\": \".*\"/\"restUrl\": \"$escapedBfxApiUrl\"/g" \ "$WORKER_FOLDER/config/service.report.json" From 8571b61516a31a1655624c37622d6a989b262dc1 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 16 Jan 2024 08:26:00 +0200 Subject: [PATCH 18/22] Cleanup electron-builder config --- electron-builder-config.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/electron-builder-config.js b/electron-builder-config.js index bf7627bb..0938f268 100644 --- a/electron-builder-config.js +++ b/electron-builder-config.js @@ -129,11 +129,6 @@ module.exports = { ...macSpecificTargets ] }, - dmg: { - // TODO: Need to check - // https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application - // sign: !isNotarize - }, files: [ '**/*', 'build/icons', From b8c107bc1343aaea7418f1553260feef7c97a8ea Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 19 Jan 2024 09:33:46 +0200 Subject: [PATCH 19/22] Bump version up to v4.18.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84509832..5a61b407 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-electron", - "version": "4.17.0", + "version": "4.18.0", "repository": "https://github.com/bitfinexcom/bfx-report-electron", "description": "Reporting tool", "author": "bitfinex.com", From 1b69762ca2578bf592fa36ed94dee1f462a7dbff Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 19 Jan 2024 09:34:20 +0200 Subject: [PATCH 20/22] Add changelog for v4.18.0 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e813f9..e1356101 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.18.0] - 2024-01-24 + +### Added + +- Added Apple signing and notarization workflow. PR: [bfx-report-electron#299](https://github.com/bitfinexcom/bfx-report-electron/pull/299) +- Implemented users informing about the [platform maintenance](https://bitfinex.statuspage.io/) mode. PR: [bfx-report-ui#756](https://github.com/bitfinexcom/bfx-report-ui/pull/756) +- Implemented configurable balances representation `Filter` for the `Summary by Asset` section. PR: [bfx-report-ui#753](https://github.com/bitfinexcom/bfx-report-ui/pull/753) + +### Security + +- Resolved `dependabot` dependency updates, bumped `follow-redirects` from `1.15.3` to `1.15.4`. PR: [bfx-report-ui#755](https://github.com/bitfinexcom/bfx-report-ui/pull/755) + ## [4.17.0] - 2024-01-10 ### Added From a1b52ee69d4b81b4db838d6a4a66a076604c8165 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 31 Jan 2024 08:21:01 +0200 Subject: [PATCH 21/22] Update sub-modules --- bfx-report-ui | 2 +- bfx-reports-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bfx-report-ui b/bfx-report-ui index 471d8d1c..1236f970 160000 --- a/bfx-report-ui +++ b/bfx-report-ui @@ -1 +1 @@ -Subproject commit 471d8d1cf15d057d310fae991da335d0d01eaf38 +Subproject commit 1236f970ba0b1c4c9b5274dd1049ade7814febf9 diff --git a/bfx-reports-framework b/bfx-reports-framework index 1fc8ca69..bd237349 160000 --- a/bfx-reports-framework +++ b/bfx-reports-framework @@ -1 +1 @@ -Subproject commit 1fc8ca6911e9382d193fc8b97ad734d7fcb6a42c +Subproject commit bd2373497d981c13ee59f53242b601cbb14ddfca From 0b24fc49c49ca28a6a600d1b50df59f8a06bcdac Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 31 Jan 2024 08:33:46 +0200 Subject: [PATCH 22/22] Extend changelog --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1356101..b48da19b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,17 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [4.18.0] - 2024-01-24 +## [4.18.0] - 2024-01-31 ### Added - Added Apple signing and notarization workflow. PR: [bfx-report-electron#299](https://github.com/bitfinexcom/bfx-report-electron/pull/299) - Implemented users informing about the [platform maintenance](https://bitfinex.statuspage.io/) mode. PR: [bfx-report-ui#756](https://github.com/bitfinexcom/bfx-report-ui/pull/756) - Implemented configurable balances representation `Filter` for the `Summary by Asset` section. PR: [bfx-report-ui#753](https://github.com/bitfinexcom/bfx-report-ui/pull/753) +- Implemented `Google Tag Manager` support for the `Reports` and events tracking. PR: [bfx-report-ui#762](https://github.com/bitfinexcom/bfx-report-ui/pull/762) + +### Changed + +- Improved user informing about the initial synchronization. PR: [bfx-report-ui#760](https://github.com/bitfinexcom/bfx-report-ui/pull/760) +- Improved login to sign in when `otp` length is `6`. PR: [bfx-report-ui#758](https://github.com/bitfinexcom/bfx-report-ui/pull/758) + +### Fixed + +- Fixed lint error. PR: [bfx-report-ui#763](https://github.com/bitfinexcom/bfx-report-ui/pull/763) ### Security - Resolved `dependabot` dependency updates, bumped `follow-redirects` from `1.15.3` to `1.15.4`. PR: [bfx-report-ui#755](https://github.com/bitfinexcom/bfx-report-ui/pull/755) +- Replaced `Lodash` `_isObject` helper usage with the corresponding one from the internal library for security reasons. PR: [bfx-report-ui#761](https://github.com/bitfinexcom/bfx-report-ui/pull/761) ## [4.17.0] - 2024-01-10