From 365e697121bd8c709c7ca8a3a8e1647074f45d17 Mon Sep 17 00:00:00 2001 From: "SPRINX0\\prochazka" Date: Thu, 5 Sep 2024 10:20:39 +0200 Subject: [PATCH] builder - updater channel --- .github/workflows/build-app-pro-beta.yaml | 6 ++++++ app/src/electron.js | 5 +++-- app/src/updaterChannel.js | 1 + setUpdaterChannel.js | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 app/src/updaterChannel.js create mode 100644 setUpdaterChannel.js diff --git a/.github/workflows/build-app-pro-beta.yaml b/.github/workflows/build-app-pro-beta.yaml index 700c971a..911ce453 100644 --- a/.github/workflows/build-app-pro-beta.yaml +++ b/.github/workflows/build-app-pro-beta.yaml @@ -60,6 +60,10 @@ jobs: cd .. cd dbgate-merged node adjustPackageJsonPremium + run: | + cd .. + cd dbgate-merged + node setUpdaterChannel premium-beta - name: yarn set timeout run: | cd .. @@ -128,6 +132,8 @@ jobs: mv ../dbgate-merged/app/dist/*.snap artifacts/ || true mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true + mv ../dbgate-merged/app/dist/*.yml artifacts/ || true + - name: Upload artifacts uses: actions/upload-artifact@v1 with: diff --git a/app/src/electron.js b/app/src/electron.js index 04b9d47e..7a4cb6f5 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -17,6 +17,7 @@ const path = require('path'); const url = require('url'); const mainMenuDefinition = require('./mainMenuDefinition'); const { isProApp } = require('./proTools'); +const updaterChannel = require('./updaterChannel'); let disableAutoUpgrade = false; // require('@electron/remote/main').initialize(); @@ -74,8 +75,8 @@ let runCommandOnLoad = null; log.transports.file.level = 'debug'; autoUpdater.logger = log; -if (isProApp()) { - autoUpdater.channel = 'premium'; +if (updaterChannel) { + autoUpdater.channel = updaterChannel; } // TODO - create settings for this // appUpdater.channel = 'beta'; diff --git a/app/src/updaterChannel.js b/app/src/updaterChannel.js new file mode 100644 index 00000000..c8a9c8eb --- /dev/null +++ b/app/src/updaterChannel.js @@ -0,0 +1 @@ +module.exports = null; \ No newline at end of file diff --git a/setUpdaterChannel.js b/setUpdaterChannel.js new file mode 100644 index 00000000..25015f8d --- /dev/null +++ b/setUpdaterChannel.js @@ -0,0 +1,14 @@ +const fs = require('fs'); + +function adjustAppFile(file) { + const channel = process.argv[2]; + const json = JSON.parse(fs.readFileSync(file, { encoding: 'utf-8' })); + json.build.mac.publish[0].channel = channel; + json.build.linux.publish[0].channel = channel; + json.build.win.publish[0].channel = channel; + fs.writeFileSync(file, JSON.stringify(json, null, 2), 'utf-8'); +} + +adjustAppFile('app/package.json'); + +fs.writeFileSync('app/src/updaterChannel.js', `module.exports = '${process.argv[2]}';`, 'utf-8');