From 974d8d4470be8a9ae6364f6a54bdcc00e9f21dfe Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 16:53:12 +0530 Subject: [PATCH 01/17] chore: Refactor electron/update.js for better readability --- electron/update.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/electron/update.js b/electron/update.js index d31153f25..512e3ca58 100644 --- a/electron/update.js +++ b/electron/update.js @@ -2,16 +2,11 @@ const { publishOptions } = require('./constants/publishOptions'); const electronUpdater = require('electron-updater'); const electronLogger = require('electron-log'); -const macUpdater = new electronUpdater.MacUpdater({ - ...publishOptions, - private: false, -}); +const macUpdater = new electronUpdater.MacUpdater({ ...publishOptions }); macUpdater.logger = electronLogger; -macUpdater.setFeedURL({ - ...publishOptions, -}); +macUpdater.setFeedURL({ ...publishOptions }); macUpdater.autoDownload = true; macUpdater.autoInstallOnAppQuit = true; From af77fbabeff17526f72173a057ae0a003aefa64d Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 17:08:05 +0530 Subject: [PATCH 02/17] chore: Update package.json with new ordering --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 614582795..af038e149 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,10 @@ { "author": "Valory AG", + "main": "electron/main.js", + "name": "olas-operate-app", + "productName": "Pearl", + "private": true, + "version": "0.1.0-rc26", "dependencies": { "@ant-design/cssinjs": "^1.18.4", "@ant-design/icons": "^5.3.0", @@ -36,10 +41,6 @@ "net": "^1.0.2", "prettier": "^3.2.5" }, - "main": "electron/main.js", - "name": "olas-operate-app", - "productName": "Pearl", - "private": true, "scripts": { "build:frontend": "cd frontend && yarn build && rm -rf ../electron/.next && cp -r .next ../electron/.next && rm -rf ../electron/public && cp -r public ../electron/public", "dev:backend": "poetry run python operate/cli.py", @@ -53,6 +54,5 @@ "test:frontend": "cd frontend && yarn test", "start": "electron .", "build": "rm -rf dist/ && electron-builder build" - }, - "version": "0.1.0-rc26" + } } From b8a978e75031534f15fcddfb9ecff2bb628729f3 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 20:38:40 +0530 Subject: [PATCH 03/17] chore: Update .env.example and build.js for IS_STAGING variables --- .env.example | 3 ++- build.js | 8 ++++---- electron/constants/publishOptions.js | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 5f8e07890..f6a88375f 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ FORK_URL= NODE_ENV= +DEV_RPC= STAKING_TEST_KEYS_PATH= -DEV_RPC= \ No newline at end of file +IS_STAGING= diff --git a/build.js b/build.js index 29e953fc4..a5059c953 100644 --- a/build.js +++ b/build.js @@ -1,6 +1,6 @@ const dotenv = require('dotenv'); const build = require('electron-builder').build; -const {publishOptions} = require('./electron/constants/publishOptions'); +const { publishOptions } = require('./electron/constants/publishOptions'); dotenv.config(); @@ -24,7 +24,7 @@ const main = async () => { target: [ { target: 'default', - arch: ['x64','arm64'], + arch: ['x64', 'arm64'], }, ], publish: publishOptions, @@ -35,11 +35,11 @@ const main = async () => { entitlements: 'electron/entitlements.mac.plist', entitlementsInherit: 'electron/entitlements.mac.plist', notarize: { - teamId: process.env.APPLETEAMID + teamId: process.env.APPLETEAMID, }, }, }, }); }; -main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e)); \ No newline at end of file +main().then((response) => { console.log('Build & Notarize complete'); }).catch((e) => console.error(e)); diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 1ecbc1d4e..3c57fb66d 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -2,10 +2,11 @@ const publishOptions = { provider: 'github', owner: 'valory-xyz', repo: 'olas-operate-app', - releaseType: 'release', token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, + releaseType: process.env.IS_STAGING === 'true' ? 'prerelease' : 'release', + channel: process.env.IS_STAGING === 'true' ? 'alpha' : 'latest', }; module.exports = { publishOptions }; From a052ccaee02f8488d7555be99ce21faefb4ee03a Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 21:23:38 +0530 Subject: [PATCH 04/17] feat: Add IS_STAGING variable to production environment configuration --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9737db6c3..55ac2dc47 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,6 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ + IS_STAGING: ${{ secrets.IS_STAGING || 'false' }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 657a7c322560dc937a451247e0fae3adb5563be8 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 21:36:56 +0530 Subject: [PATCH 05/17] chore: Fix typo in electron/install.js and add a comment for 'Version' --- electron/install.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/install.js b/electron/install.js index 5b9a88734..b8a40eeaa 100644 --- a/electron/install.js +++ b/electron/install.js @@ -7,6 +7,11 @@ const process = require('process'); const { spawnSync } = require('child_process'); const Docker = require('dockerode'); +/** + * current version of the pearl release + * - use "rc" for release candidate, for example "0.1.0rc26" + * - use "alpha" for alpha release, for example "0.1.0alpha26" + */ const Version = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; const VenvDir = `${OperateDirectory}/venv`; @@ -46,7 +51,7 @@ function appendLog(log) { function runCmdUnix(command, options) { fs.appendFileSync( OperateInstallationLog, - `Runninng ${command} with options ${JSON.stringify(options)}`, + `Running ${command} with options ${JSON.stringify(options)}`, { encoding: 'utf-8' }, ); let bin = getBinPath(command); From 38cbeb6fc70ce36601dd15606d6489f794553dea Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 29 May 2024 23:28:08 +0530 Subject: [PATCH 06/17] feat: Add appVersion to electron store and display it in TopBar --- electron/main.js | 5 ++++- electron/store.js | 20 +++++++++++++++----- frontend/components/Layout/TopBar.tsx | 8 +++++++- frontend/types/ElectronApi.ts | 1 + 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/electron/main.js b/electron/main.js index 7035d0ea6..90fbd5681 100644 --- a/electron/main.js +++ b/electron/main.js @@ -256,7 +256,10 @@ const createMainWindow = () => { mainWindow.hide(); }); - setupStoreIpc(ipcMain, mainWindow); + const storeInitialValues = { + appVersion: app.getVersion(), + }; + setupStoreIpc(ipcMain, mainWindow, storeInitialValues); if (isDev) { mainWindow.webContents.openDevTools(); diff --git a/electron/store.js b/electron/store.js index 91cde5bef..e9efd1ee5 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,5 +1,9 @@ // set schema to validate store data -const schema = { +const defaultSchema = { + appVersion: { + type: 'string', + default: '', + }, isInitialFunded: { type: 'boolean', default: false, @@ -14,14 +18,20 @@ const schema = { }, }; -const setupStoreIpc = async (ipcChannel, mainWindow) => { +const setupStoreIpc = async (ipcChannel, mainWindow, storeInitialValues) => { const Store = (await import('electron-store')).default; - /** @type import Store from 'electron-store' */ - const store = new Store({ - schema, + // set default values for store + const schema = Object.assign({}, defaultSchema); + Object.keys(schema).forEach((key) => { + if (storeInitialValues[key] !== undefined) { + schema[key].default = storeInitialValues[key]; + } }); + /** @type import Store from 'electron-store' */ + const store = new Store({ schema }); + store.onDidAnyChange((data) => { if (mainWindow?.webContents) mainWindow.webContents.send('store-changed', data); diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index a98b26363..dd12ec11c 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -3,6 +3,7 @@ import styled from 'styled-components'; import { COLOR } from '@/constants'; import { useElectronApi } from '@/hooks/useElectronApi'; +import { useStore } from '@/hooks/useStore'; const { Text } = Typography; @@ -48,6 +49,8 @@ const TopBarContainer = styled.div` export const TopBar = () => { const electronApi = useElectronApi(); + const store = useStore(); + return ( @@ -56,7 +59,10 @@ export const TopBar = () => { - Pearl (alpha) + + Pearl (alpha) + {store?.storeState?.appVersion?.includes('rc') ? ' (staging)' : ''} + ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index 221b00000..3a5df5c96 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,4 +1,5 @@ export type ElectronStore = { + appVersion?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean; From 06608150a185067c30abc5aee5d37d1cbd1721ce Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 05:23:04 +0530 Subject: [PATCH 07/17] feat: Update electron updater to automatically update to all channels --- electron/update.js | 5 ++++- frontend/components/Layout/TopBar.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/update.js b/electron/update.js index 512e3ca58..b975e5ee6 100644 --- a/electron/update.js +++ b/electron/update.js @@ -2,7 +2,10 @@ const { publishOptions } = require('./constants/publishOptions'); const electronUpdater = require('electron-updater'); const electronLogger = require('electron-log'); -const macUpdater = new electronUpdater.MacUpdater({ ...publishOptions }); +const macUpdater = new electronUpdater.MacUpdater({ + ...publishOptions, + channels: ['latest', 'beta', 'alpha'], // automatically update to all channels +}); macUpdater.logger = electronLogger; diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index dd12ec11c..fa9d6328a 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -61,7 +61,7 @@ export const TopBar = () => { Pearl (alpha) - {store?.storeState?.appVersion?.includes('rc') ? ' (staging)' : ''} + {store?.storeState?.appVersion?.includes('rc') ? '' : ' (staging)'} ); From c6897f872862b34b26fca6bcdcc1672ee07868a2 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 15:25:22 +0530 Subject: [PATCH 08/17] chore: Update electron/install.js and TopBar.tsx for app version display and staging indicator --- electron/install.js | 4 ++-- frontend/components/Layout/TopBar.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/electron/install.js b/electron/install.js index b8a40eeaa..2a5c8586c 100644 --- a/electron/install.js +++ b/electron/install.js @@ -9,8 +9,8 @@ const Docker = require('dockerode'); /** * current version of the pearl release - * - use "rc" for release candidate, for example "0.1.0rc26" - * - use "alpha" for alpha release, for example "0.1.0alpha26" + * - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26" + * - use "alpha" for alpha release, for example "0.1.0rc26-alpha" */ const Version = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index fa9d6328a..b16321cbf 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -47,6 +47,10 @@ const TopBarContainer = styled.div` -webkit-app-region: drag; `; +const isStaging = (version?: string) => { + return !!version && (version.includes('alpha') || version.includes('beta')); +}; + export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); @@ -61,7 +65,7 @@ export const TopBar = () => { Pearl (alpha) - {store?.storeState?.appVersion?.includes('rc') ? '' : ' (staging)'} + {isStaging(store?.storeState?.appVersion) ? ' (staging)' : ''} ); From 92e40467cb053eee91b5e3a447b12caa170a1238 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 22:43:42 +0530 Subject: [PATCH 09/17] chore: Update releaseType in publishOptions and store schema --- electron/constants/publishOptions.js | 3 +-- electron/store.js | 21 +++++---------------- frontend/components/Layout/TopBar.tsx | 21 +++++++++++++-------- frontend/types/ElectronApi.ts | 1 + 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 3c57fb66d..196f5be0d 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -5,8 +5,7 @@ const publishOptions = { token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, - releaseType: process.env.IS_STAGING === 'true' ? 'prerelease' : 'release', - channel: process.env.IS_STAGING === 'true' ? 'alpha' : 'latest', + releaseType: process.env.IS_STAGING === 'true' ? 'draft' : 'release', }; module.exports = { publishOptions }; diff --git a/electron/store.js b/electron/store.js index e9efd1ee5..4b06cfff8 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,21 +1,10 @@ // set schema to validate store data const defaultSchema = { - appVersion: { - type: 'string', - default: '', - }, - isInitialFunded: { - type: 'boolean', - default: false, - }, - firstStakingRewardAchieved: { - type: 'boolean', - default: false, - }, - firstRewardNotificationShown: { - type: 'boolean', - default: false, - }, + appVersion: { type: 'string', default: '' }, + releaseType: { type: 'string', default: '' }, + isInitialFunded: { type: 'boolean', default: false }, + firstStakingRewardAchieved: { type: 'boolean', default: false }, + firstRewardNotificationShown: { type: 'boolean', default: false }, }; const setupStoreIpc = async (ipcChannel, mainWindow, storeInitialValues) => { diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index b16321cbf..d9e7be9c8 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -1,4 +1,5 @@ import { Typography } from 'antd'; +import { useMemo } from 'react'; import styled from 'styled-components'; import { COLOR } from '@/constants'; @@ -47,14 +48,21 @@ const TopBarContainer = styled.div` -webkit-app-region: drag; `; -const isStaging = (version?: string) => { - return !!version && (version.includes('alpha') || version.includes('beta')); -}; - export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); + const versionName = useMemo(() => { + const releaseType = store?.storeState?.releaseType; + if (releaseType === 'draft') return ' (staging)'; + + const appVersion = store?.storeState?.appVersion; + if (!appVersion) return ''; + if (appVersion.includes('alpha')) return ''; // TODO + if (appVersion.includes('beta')) return ''; // TODO + return ''; + }, [store?.storeState?.appVersion, store?.storeState?.releaseType]); + return ( @@ -63,10 +71,7 @@ export const TopBar = () => { - - Pearl (alpha) - {isStaging(store?.storeState?.appVersion) ? ' (staging)' : ''} - + {`Pearl (alpha) ${versionName}`.trim()} ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index 3a5df5c96..ab1937e9e 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,5 +1,6 @@ export type ElectronStore = { appVersion?: string; + releaseType?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean; From afe5407af3018ae683fde45587df97dc49ba2d75 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Thu, 30 May 2024 22:55:10 +0530 Subject: [PATCH 10/17] chore: Update releaseType in publishOptions and store schema --- electron/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/electron/main.js b/electron/main.js index 90fbd5681..00700f01e 100644 --- a/electron/main.js +++ b/electron/main.js @@ -258,6 +258,7 @@ const createMainWindow = () => { const storeInitialValues = { appVersion: app.getVersion(), + releaseType: process.env.IS_STAGING ? 'draft' : 'release', }; setupStoreIpc(ipcMain, mainWindow, storeInitialValues); From b2f88082a7622267cb249da1f3e8cd9a942f8685 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Fri, 31 May 2024 19:53:48 +0530 Subject: [PATCH 11/17] chore: Update IS_STAGING variable in production environment configuration --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55ac2dc47..9f3c75dab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ - IS_STAGING: ${{ secrets.IS_STAGING || 'false' }} + IS_STAGING: ${{ contains(github.ref, '.dev') }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 3d3b70ed2a10c0f7b9815cbb2c55e8efb1fa5606 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Fri, 31 May 2024 19:54:16 +0530 Subject: [PATCH 12/17] chore: Update IS_STAGING variable in production environment configuration --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f3c75dab..0deab94b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ - IS_STAGING: ${{ contains(github.ref, '.dev') }} + IS_STAGING: ${{ contains(github.ref, 'staging') }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish" From 9f7aaf2cfc7d551a42caf19ba52d8ba21eb06770 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Mon, 3 Jun 2024 16:04:14 +0530 Subject: [PATCH 13/17] chore: Update publishOptions releaseType to 'draft' in electron/constants/publishOptions.js and update olas-operate-middleware version to '0.1.0rc26' in electron/install.js --- electron/constants/publishOptions.js | 2 +- electron/install.js | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/electron/constants/publishOptions.js b/electron/constants/publishOptions.js index 196f5be0d..60529d284 100644 --- a/electron/constants/publishOptions.js +++ b/electron/constants/publishOptions.js @@ -5,7 +5,7 @@ const publishOptions = { token: process.env.GH_TOKEN, private: false, publishAutoUpdate: true, - releaseType: process.env.IS_STAGING === 'true' ? 'draft' : 'release', + releaseType: 'draft', }; module.exports = { publishOptions }; diff --git a/electron/install.js b/electron/install.js index 2a5c8586c..1b54e6e4b 100644 --- a/electron/install.js +++ b/electron/install.js @@ -12,7 +12,7 @@ const Docker = require('dockerode'); * - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26" * - use "alpha" for alpha release, for example "0.1.0rc26-alpha" */ -const Version = '0.1.0rc26'; +const OlasMiddlewareVersion = '0.1.0rc26'; const OperateDirectory = `${os.homedir()}/.operate`; const VenvDir = `${OperateDirectory}/venv`; const VersionFile = `${OperateDirectory}/version.txt`; @@ -83,7 +83,7 @@ function runSudoUnix(command, options) { if (!bin) { throw new Error(`Command ${command} not found`); } - return new Promise(function (resolve, reject) { + return new Promise(function (resolve, _reject) { sudo.exec( `${bin} ${options}`, SudoOptions, @@ -162,7 +162,7 @@ function installOperatePackageUnix(path) { '-m', 'pip', 'install', - `olas-operate-middleware==${Version}`, + `olas-operate-middleware==${OlasMiddlewareVersion}`, ]); } @@ -172,7 +172,7 @@ function reInstallOperatePackageUnix(path) { '-m', 'pip', 'install', - `olas-operate-middleware==${Version}`, + `olas-operate-middleware==${OlasMiddlewareVersion}`, '--force-reinstall', ]); } @@ -182,11 +182,11 @@ function installOperateCli(path) { if (fs.existsSync(installPath)) { fs.rmSync(installPath); } - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { fs.copyFile( `${OperateDirectory}/venv/bin/operate`, installPath, - function (error, stdout, stderr) { + function (error, _stdout, _stderr) { resolve(!error); }, ); @@ -197,7 +197,7 @@ function createDirectory(path) { if (fs.existsSync(path)) { return; } - return new Promise((resolve, reject) => { + return new Promise((resolve, _reject) => { fs.mkdir(path, { recursive: true }, (error) => { resolve(!error); }); @@ -205,15 +205,15 @@ function createDirectory(path) { } function writeVersion() { - fs.writeFileSync(VersionFile, Version); + fs.writeFileSync(VersionFile, OlasMiddlewareVersion); } function versionBumpRequired() { if (!fs.existsSync(VersionFile)) { return true; } - const version = fs.readFileSync(VersionFile).toString(); - return version != Version; + const olasMiddlewareVersionInFile = fs.readFileSync(VersionFile).toString(); + return olasMiddlewareVersionInFile != OlasMiddlewareVersion; } function removeLogFile() { @@ -270,7 +270,9 @@ async function setupDarwin(ipcChannel) { console.log(appendLog('Checking if upgrade is required')); if (versionBumpRequired()) { - console.log(appendLog(`Upgrading pearl daemon to ${Version}`)); + console.log( + appendLog(`Upgrading pearl daemon to ${OlasMiddlewareVersion}`), + ); reInstallOperatePackageUnix(OperateDirectory); writeVersion(); removeLogFile(); @@ -327,7 +329,9 @@ async function setupUbuntu(ipcChannel) { console.log(appendLog('Checking if upgrade is required')); if (versionBumpRequired()) { - console.log(appendLog(`Upgrading pearl daemon to ${Version}`)); + console.log( + appendLog(`Upgrading pearl daemon to ${OlasMiddlewareVersion}`), + ); reInstallOperatePackageUnix(OperateDirectory); writeVersion(); removeLogFile(); From b9cbf284a7f6bedbfd0756ad5f2a0b32629dcb48 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Mon, 3 Jun 2024 16:09:18 +0530 Subject: [PATCH 14/17] chore: Update environmentName in store schema and TopBar component --- electron/main.js | 3 +-- electron/store.js | 3 +-- frontend/components/Layout/TopBar.tsx | 15 ++------------- frontend/types/ElectronApi.ts | 3 +-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/electron/main.js b/electron/main.js index 00700f01e..7b9d06a1a 100644 --- a/electron/main.js +++ b/electron/main.js @@ -257,8 +257,7 @@ const createMainWindow = () => { }); const storeInitialValues = { - appVersion: app.getVersion(), - releaseType: process.env.IS_STAGING ? 'draft' : 'release', + environmentName: process.env.IS_STAGING ? 'staging' : '', }; setupStoreIpc(ipcMain, mainWindow, storeInitialValues); diff --git a/electron/store.js b/electron/store.js index 4b06cfff8..5577decff 100644 --- a/electron/store.js +++ b/electron/store.js @@ -1,7 +1,6 @@ // set schema to validate store data const defaultSchema = { - appVersion: { type: 'string', default: '' }, - releaseType: { type: 'string', default: '' }, + environmentName: { type: 'string', default: '' }, isInitialFunded: { type: 'boolean', default: false }, firstStakingRewardAchieved: { type: 'boolean', default: false }, firstRewardNotificationShown: { type: 'boolean', default: false }, diff --git a/frontend/components/Layout/TopBar.tsx b/frontend/components/Layout/TopBar.tsx index d9e7be9c8..c36f3054f 100644 --- a/frontend/components/Layout/TopBar.tsx +++ b/frontend/components/Layout/TopBar.tsx @@ -1,5 +1,4 @@ import { Typography } from 'antd'; -import { useMemo } from 'react'; import styled from 'styled-components'; import { COLOR } from '@/constants'; @@ -51,17 +50,7 @@ const TopBarContainer = styled.div` export const TopBar = () => { const electronApi = useElectronApi(); const store = useStore(); - - const versionName = useMemo(() => { - const releaseType = store?.storeState?.releaseType; - if (releaseType === 'draft') return ' (staging)'; - - const appVersion = store?.storeState?.appVersion; - if (!appVersion) return ''; - if (appVersion.includes('alpha')) return ''; // TODO - if (appVersion.includes('beta')) return ''; // TODO - return ''; - }, [store?.storeState?.appVersion, store?.storeState?.releaseType]); + const envName = store?.storeState?.environmentName; return ( @@ -71,7 +60,7 @@ export const TopBar = () => { - {`Pearl (alpha) ${versionName}`.trim()} + {`Pearl (alpha) ${envName ? `(${envName})` : ''}`.trim()} ); }; diff --git a/frontend/types/ElectronApi.ts b/frontend/types/ElectronApi.ts index ab1937e9e..2f586a0d9 100644 --- a/frontend/types/ElectronApi.ts +++ b/frontend/types/ElectronApi.ts @@ -1,6 +1,5 @@ export type ElectronStore = { - appVersion?: string; - releaseType?: string; + environmentName?: string; isInitialFunded?: boolean; firstStakingRewardAchieved?: boolean; firstRewardNotificationShown?: boolean; From f5a98bab7890352a4b60c3e9c9988667436f4f6b Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Mon, 3 Jun 2024 18:29:03 +0530 Subject: [PATCH 15/17] chore: Remove private flag from package.json --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index ae3ca6299..bc7c5f1e3 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "main": "electron/main.js", "name": "olas-operate-app", "productName": "Pearl", - "private": true, "version": "0.1.0-rc34", "dependencies": { "@ant-design/cssinjs": "^1.18.4", From c1232c6db8889094d3319c651c0b23b21645c040 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 4 Jun 2024 16:51:16 +0100 Subject: [PATCH 16/17] chore: Update version to "0.1.0-rc34.1" in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc7c5f1e3..2c454e588 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "main": "electron/main.js", "name": "olas-operate-app", "productName": "Pearl", - "version": "0.1.0-rc34", + "version": "0.1.0-rc34.1", "dependencies": { "@ant-design/cssinjs": "^1.18.4", "@ant-design/icons": "^5.3.0", From 9b9c5738434a0280f23cc10074163b37fbf8c4e8 Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Wed, 5 Jun 2024 01:44:14 +0530 Subject: [PATCH 17/17] chore: Update IS_STAGING environment variable in release.yml workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0deab94b3..71bf0b5f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: env: NODE_ENV: production DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ - IS_STAGING: ${{ contains(github.ref, 'staging') }} + IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }} FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ - run: rm -rf /dist - name: "Build, notarize, publish"