From ee6ace6bc8184fb78aab003710be2fbd0d8839d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczyk?= Date: Fri, 26 Jul 2024 10:05:54 +0200 Subject: [PATCH] fix: prod release workflow, reading props of undefined (#1527) --- .github/workflows/main_branch.yaml | 2 +- .releaserc.js | 15 ++++++--------- .../events/networksUpdatedEventListener.ts | 2 +- src/contexts/NetworkProvider.tsx | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main_branch.yaml b/.github/workflows/main_branch.yaml index 55f609f82..f5866e71b 100644 --- a/.github/workflows/main_branch.yaml +++ b/.github/workflows/main_branch.yaml @@ -61,5 +61,5 @@ jobs: - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_BRANCH: main + RELEASE_TYPE: alpha run: yarn run semantic-release diff --git a/.releaserc.js b/.releaserc.js index 8262cd69e..161cfd446 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -2,15 +2,15 @@ This file contains the configuration for semantic release, the library we use to tag the correct semantic version numbers onto releases. We have two release paths, one on main and one on release branch. -In the code below we check the env variable RELEASE_BRANCH to decide what we should do. As of +In the code below we check the env variable RELEASE_TYPE to decide what we should do. As of the time of this file semantic release does not support specifying a config file from their CLI, so this is the only we can have dynamic configs based on branch. To test run this file, first get a github token at https://github.com/settings/tokens -and add it to the GITHUB_TOKEN env variable then specify what branch you want to run (main or release) under RELEASE_BRANCH +and add it to the GITHUB_TOKEN env variable then specify what kind of release ou want to run (production or alpha) under RELEASE_TYPE $ export GITHUB_TOKEN= -$ export RELEASE_BRANCH=
+$ export RELEASE_TYPE= $ run yarn run semantic-release -d @@ -100,7 +100,7 @@ const execSentryReleaseSetting = [ ]; let plugins; -if (process.env && process.env.RELEASE_BRANCH === 'release') { +if (process.env && process.env.RELEASE_TYPE === 'production') { plugins = [ commitAnalyzerSetting, execSentryReleaseSetting, @@ -120,10 +120,7 @@ if (process.env && process.env.RELEASE_BRANCH === 'release') { module.exports = { // define a main version release branch even though we are doing all releases from main - // this branch list gets overwritten in the production release Github Action - branches: [ - 'release', - { name: 'main', prerelease: 'alpha'} - ], + // this branch list gets overwritten in the production release Github Action + branches: ['release', { name: 'main', prerelease: 'alpha' }], plugins, }; diff --git a/src/background/services/network/events/networksUpdatedEventListener.ts b/src/background/services/network/events/networksUpdatedEventListener.ts index 4365783bf..76b7d7982 100644 --- a/src/background/services/network/events/networksUpdatedEventListener.ts +++ b/src/background/services/network/events/networksUpdatedEventListener.ts @@ -4,7 +4,7 @@ import { Network, NetworkEvents } from '../models'; export function networksUpdatedEventListener( evt: ExtensionConnectionEvent<{ networks: Network[]; - activeNetwork: Network; + activeNetwork?: Network; favoriteNetworks: number[]; customNetworks: Record; }> diff --git a/src/contexts/NetworkProvider.tsx b/src/contexts/NetworkProvider.tsx index 0fcaca6b8..4b3612cd7 100644 --- a/src/contexts/NetworkProvider.tsx +++ b/src/contexts/NetworkProvider.tsx @@ -193,7 +193,7 @@ export function NetworkContextProvider({ children }: { children: any }) { setNetworks(result.networks); setNetwork((currentNetwork) => { const newNetwork = result.activeNetwork ?? currentNetwork; // do not delete currently set network - networkChanged.dispatch(newNetwork.caipId); + networkChanged.dispatch(newNetwork?.caipId); return newNetwork; });