diff --git a/.github/workflows/pr-trigger.yml b/.github/workflows/pr-trigger.yml index b31bd618d..b2a374248 100644 --- a/.github/workflows/pr-trigger.yml +++ b/.github/workflows/pr-trigger.yml @@ -18,6 +18,7 @@ jobs: - name: Checkout frontend mono repo uses: actions/checkout@v3 with: + # We need to fetch all branches and commits so that Nx affected has a base to compare against. fetch-depth: 0 - name: Check node version @@ -33,10 +34,9 @@ jobs: # Check SHAs - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v2 + uses: nrwl/nx-set-shas@v3 with: - main-branch-name: ${{ github.base_ref || github.ref_name }} - set-environment-variables-for-job: true + main-branch-name: develop # See affected apps - name: See affected apps @@ -44,8 +44,36 @@ jobs: nx_version=$(cat package.json | grep '"nx"' | cut -d ':' -f 2 | tr -d '",[:space:]') rm package.json yarn.lock yarn add nx@$nx_version - affected=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects) + + echo ">>>> debug" + echo "NX Version: $nx_version" + echo "NX_BASE: ${{ env.NX_BASE }}" + echo "NX_HEAD: ${{ env.NX_HEAD }}" + + # echo "Main branch name: ${{ github.base_ref || github.ref_name }}" + # echo "git rev-parse HEAD: $(git rev-parse HEAD)" + # echo "Head: ${{ github.head_ref }}" + + # echo "command to execute: 'yarn nx print-affected --base=${{ github.base_ref || github.ref_name }} --head=${{ github.head_ref }} --select=projects'" + + # merge_base=$(git merge-base origin/develop HEAD) + # echo "git merge-base origin/develop HEAD: $merge_base" + + # head_sha="${{ github.event.pull_request.head.sha || github.sha }}" + # echo "Head SHA: $head_sha" + + # echo "command to execute (without nx-set-sha): 'yarn nx print-affected --base=$merge_base --head=$head_sha --select=projects'" + echo ">>>> eof debug" + + # affected_1=$(yarn nx print-affected --base=$merge_base --head=$head_sha --select=projects || true) + # echo -n "Affected projects (allowed to fail): $affected_1" + + # affected=$(yarn nx print-affected --base=${{ github.base_ref || github.ref_name }} --head=${{ github.head_ref }} --select=projects) + # echo -n "Affected projects: $affected" + + affected="$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=HEAD --select=projects)" echo -n "Affected projects: $affected" + projects_e2e="" if [[ $affected == *"governance"* ]]; then projects_e2e+='"governance-e2e" '; fi if [[ $affected == *"trading"* ]]; then projects_e2e+='"trading-e2e" '; fi diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index ade5b4dc2..690bbec8a 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -8,6 +8,7 @@ on: required: true type: choice options: + - announcements - ui-toolkit - react-helpers - tailwindcss-config diff --git a/apps/explorer/.env.capsule b/apps/explorer/.env.capsule index eda61b750..4530ff808 100644 --- a/apps/explorer/.env.capsule +++ b/apps/explorer/.env.capsule @@ -3,6 +3,7 @@ NX_TENDERMINT_URL=http://localhost:26617 NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket NX_VEGA_ENV=CUSTOM NX_ETHERSCAN_URL=https://sepolia.etherscan.io +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json # App flags NX_EXPLORER_ASSETS=1 diff --git a/apps/explorer/.env.devnet b/apps/explorer/.env.devnet index 22b999009..a4b40103e 100644 --- a/apps/explorer/.env.devnet +++ b/apps/explorer/.env.devnet @@ -8,3 +8,4 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz NX_VEGA_URL=https://api.devnet1.vega.xyz/graphql NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.mainnet b/apps/explorer/.env.mainnet index 73a40c4b9..efb8f4574 100644 --- a/apps/explorer/.env.mainnet +++ b/apps/explorer/.env.mainnet @@ -6,3 +6,4 @@ NX_VEGA_ENV=MAINNET NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/ NX_ETHERSCAN_URL=https://etherscan.io NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.mirror b/apps/explorer/.env.mirror index 3ad5277e9..8de0e3663 100644 --- a/apps/explorer/.env.mirror +++ b/apps/explorer/.env.mirror @@ -6,6 +6,7 @@ NX_VEGA_ENV=MIRROR NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.xyz/rest/ NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://mainnet-mirror.token.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json # App flags NX_EXPLORER_ASSETS=1 diff --git a/apps/explorer/.env.sandbox b/apps/explorer/.env.sandbox index 41b01badc..1db66f917 100644 --- a/apps/explorer/.env.sandbox +++ b/apps/explorer/.env.sandbox @@ -9,3 +9,4 @@ NX_TENDERMINT_URL=https://tm.sandbox.vega.xyz NX_TENDERMINT_WEBSOCKET_URL=wss://be.sandbox.vega.xyz/websocket NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://sandbox.token.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.stagnet1 b/apps/explorer/.env.stagnet1 index 56ecf5dbf..2bf424130 100644 --- a/apps/explorer/.env.stagnet1 +++ b/apps/explorer/.env.stagnet1 @@ -11,3 +11,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.stagnet3 b/apps/explorer/.env.stagnet3 index 461d4cf8b..d9d30a30c 100644 --- a/apps/explorer/.env.stagnet3 +++ b/apps/explorer/.env.stagnet3 @@ -5,3 +5,4 @@ NX_VEGA_ENV=STAGNET3 NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest NX_VEGA_GOVERNANCE_URL=https://stagnet3.token.vega.xyz NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases/ +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.testnet b/apps/explorer/.env.testnet index d79d0623d..8a0843396 100644 --- a/apps/explorer/.env.testnet +++ b/apps/explorer/.env.testnet @@ -8,3 +8,4 @@ NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/explorer/.env.validator-testnet b/apps/explorer/.env.validator-testnet index 2f468bf75..83e3b77f1 100644 --- a/apps/explorer/.env.validator-testnet +++ b/apps/explorer/.env.validator-testnet @@ -5,6 +5,7 @@ NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql NX_VEGA_REST=https://api-validators-testnet.vega.rocks/ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz NX_TENDERMINT_URL=https://tm-be.validators-testnet.vega.rocks diff --git a/apps/explorer/.env.vegacapsule b/apps/explorer/.env.vegacapsule index 4cb46d092..fd20f51e9 100644 --- a/apps/explorer/.env.vegacapsule +++ b/apps/explorer/.env.vegacapsule @@ -4,3 +4,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26607/websocket NX_VEGA_ENV=CUSTOM NX_BLOCK_EXPLORER= NX_ETHERSCAN_URL=https://sepolia.etherscan.io +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json diff --git a/apps/explorer/src/app/routes/layout.tsx b/apps/explorer/src/app/routes/layout.tsx index ee3aa900e..3e6a47b3e 100644 --- a/apps/explorer/src/app/routes/layout.tsx +++ b/apps/explorer/src/app/routes/layout.tsx @@ -3,16 +3,14 @@ import { useAssetDetailsDialogStore, } from '@vegaprotocol/assets'; import { t } from '@vegaprotocol/i18n'; +import { useEnvironment } from '@vegaprotocol/environment'; +import { AnnouncementBanner } from '@vegaprotocol/announcements'; import { - AnnouncementBanner, BackgroundVideo, BreadcrumbsContainer, ButtonLink, - ExternalLink, - Icon, } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; -import { useState } from 'react'; import { isRouteErrorResponse, Link, @@ -37,35 +35,9 @@ const DialogsContainer = () => { ); }; -const MainnetSimAd = () => { - const [shouldDisplayBanner, setShouldDisplayBanner] = useState(true); - - // Return an empty div so that the grid layout in _app.page.ts - // renders correctly - if (!shouldDisplayBanner) { - return
; - } - - return ( - -
- -
- Mainnet sim 3 is live! - Learn more -
-
-
- ); -}; - export const Layout = () => { const isHome = Boolean(useMatch(Routes.HOME)); + const { ANNOUNCEMENTS_CONFIG_URL } = useEnvironment(); return ( <>
{ )} >
- + {ANNOUNCEMENTS_CONFIG_URL && ( + + )}
diff --git a/apps/governance/.env b/apps/governance/.env index 70a8aa548..23a2cdcd6 100644 --- a/apps/governance/.env +++ b/apps/governance/.env @@ -13,6 +13,7 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json #Test configuration variables CYPRESS_FAIRGROUND=false diff --git a/apps/governance/.env.capsule b/apps/governance/.env.capsule index ef175f680..37f49fcd2 100644 --- a/apps/governance/.env.capsule +++ b/apps/governance/.env.capsule @@ -16,6 +16,7 @@ NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json #Test configuration variables CYPRESS_FAIRGROUND=false diff --git a/apps/governance/.env.devnet b/apps/governance/.env.devnet index 633e6e244..8f5e70d72 100644 --- a/apps/governance/.env.devnet +++ b/apps/governance/.env.devnet @@ -10,3 +10,4 @@ NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/governance/.env.mainnet b/apps/governance/.env.mainnet index 4f23f934c..f947895f8 100644 --- a/apps/governance/.env.mainnet +++ b/apps/governance/.env.mainnet @@ -11,3 +11,4 @@ NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40:87edc2605e544f888305d7fc4a9141bd@o286262.ingest.sentry.io/5882996 NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-mainnet-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json diff --git a/apps/governance/.env.mirror b/apps/governance/.env.mirror index b19e33cb4..e9d02a7f0 100644 --- a/apps/governance/.env.mirror +++ b/apps/governance/.env.mirror @@ -9,3 +9,4 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_VEGA_EXPLORER_URL=https://mirror.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_DELEGATIONS_PAGINATION=50 +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json \ No newline at end of file diff --git a/apps/governance/.env.sandbox b/apps/governance/.env.sandbox index 375c40dd8..e83df1671 100644 --- a/apps/governance/.env.sandbox +++ b/apps/governance/.env.sandbox @@ -6,3 +6,4 @@ NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-inter NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/governance/.env.stagnet1 b/apps/governance/.env.stagnet1 index 02f8dead9..09564786c 100644 --- a/apps/governance/.env.stagnet1 +++ b/apps/governance/.env.stagnet1 @@ -7,3 +7,4 @@ NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/governance/.env.stagnet3 b/apps/governance/.env.stagnet3 index 900fdf20b..f90baae40 100644 --- a/apps/governance/.env.stagnet3 +++ b/apps/governance/.env.stagnet3 @@ -8,3 +8,4 @@ NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json \ No newline at end of file diff --git a/apps/governance/.env.testnet b/apps/governance/.env.testnet index aca146870..d3215abfd 100644 --- a/apps/governance/.env.testnet +++ b/apps/governance/.env.testnet @@ -11,3 +11,4 @@ NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-testnet-k8s.ops.vega.xyz +NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json diff --git a/apps/governance/src/components/page-templates/template-sidebar.tsx b/apps/governance/src/components/page-templates/template-sidebar.tsx index 62fb61072..08e6be575 100644 --- a/apps/governance/src/components/page-templates/template-sidebar.tsx +++ b/apps/governance/src/components/page-templates/template-sidebar.tsx @@ -1,9 +1,6 @@ import { Networks, useEnvironment } from '@vegaprotocol/environment'; -import { - ViewingAsBanner, - AnnouncementBanner, - ExternalLink, -} from '@vegaprotocol/ui-toolkit'; +import { ViewingAsBanner } from '@vegaprotocol/ui-toolkit'; +import { AnnouncementBanner } from '@vegaprotocol/announcements'; import { useVegaWallet } from '@vegaprotocol/wallet'; import React from 'react'; @@ -15,18 +12,16 @@ export interface TemplateSidebarProps { } export function TemplateSidebar({ children, sidebar }: TemplateSidebarProps) { - const { VEGA_ENV } = useEnvironment(); + const { VEGA_ENV, ANNOUNCEMENTS_CONFIG_URL } = useEnvironment(); const { isReadOnly, pubKey, disconnect } = useVegaWallet(); return ( <> - -
- Wait no longer, SIM3 is here! - - Learn more - -
-
+ {ANNOUNCEMENTS_CONFIG_URL && ( + + )}