diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 77744c5759..27ce2b2563 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -6,6 +6,15 @@ on: branches: [main, develop] tags: [v*] workflow_dispatch: # Manually trigger it via UI/CLI/API + inputs: + app: + description: App to deploy + required: true + type: choice + options: + - COWSWAP + - EXPLORER + - ALL jobs: @@ -17,6 +26,7 @@ jobs: secrets: inherit with: env_name: dev + app: ALL vercel-pre-prod: # Deploys to Vercel staging and barn environments @@ -29,6 +39,7 @@ jobs: env_name: [barn, staging] # deploys both in parallel with: env_name: ${{ matrix.env_name }} + app: ALL vercel-prod: # Deploys to Vercel prod environment @@ -38,3 +49,4 @@ jobs: secrets: inherit with: env_name: prod + app: ${{ inputs.app }} diff --git a/.github/workflows/vercel.yml b/.github/workflows/vercel.yml index b80c4edacd..864c4d5644 100644 --- a/.github/workflows/vercel.yml +++ b/.github/workflows/vercel.yml @@ -7,6 +7,10 @@ on: description: 'Environment to deploy to. Options are: dev, staging, barn and prod' required: true type: string + app: + description: 'Application to deploy. Options are: ALL, COWSWAP, EXPLORER' + required: true + type: string env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -17,13 +21,17 @@ jobs: environment: ${{ inputs.env_name }} # Environment rules defined on GH UI concurrency: ${{ inputs.env_name }} # Only one run per env at a time + strategy: + matrix: + project_suffix: ${{ inputs.app == 'ALL' && [COWSWAP, EXPLORER] || [input.app] }} + steps: - name: Checkout code uses: actions/checkout@v3 - name: Set VERCEL_PROJECT_ID env var # It's set in each env's config on https://github.com/cowprotocol/cowswap/settings/environments - run: echo "VERCEL_PROJECT_ID=${{ secrets.VERCEL_PROJECT_ID }}" >> $GITHUB_ENV + run: echo "VERCEL_PROJECT_ID=${{ secrets[format('VERCEL_PROJECT_ID_{0}', matrix.project_suffix)] }}" >> $GITHUB_ENV - name: Install Vercel CLI run: npm install --global vercel@latest @@ -33,6 +41,7 @@ jobs: - name: Build Project Artifacts run: > + : # CoWSwap env vars REACT_APP_SENTRY_DSN=${{ secrets.SENTRY_DSN }} REACT_APP_PINATA_API_KEY=${{ secrets.REACT_APP_PINATA_API_KEY }} REACT_APP_PINATA_SECRET_API_KEY=${{ secrets.REACT_APP_PINATA_SECRET_API_KEY }} @@ -45,6 +54,13 @@ jobs: REACT_APP_NETWORK_URL_5=${{ secrets.REACT_APP_NETWORK_URL_5 }} REACT_APP_NETWORK_URL_11155111=${{ secrets.REACT_APP_NETWORK_URL_11155111 }} REACT_APP_WC_PROJECT_ID=${{ secrets.REACT_APP_WC_PROJECT_ID }} + : # Explorer env vars + REACT_APP_IPFS_READ_URI=${{ secrets.REACT_APP_IPFS_READ_URI }} + REACT_APP_EXPLORER_SENTRY_DSN=${{ secrets.EXPLORER_SENTRY_DSN }} + REACT_APP_EXPLORER_GOOGLE_ANALYTICS_ID=${{ secrets.EXPLORER_GOOGLE_ANALYTICS_ID }} + REACT_APP_SUBGRAPH_URL_MAINNET=${{ secrets.REACT_APP_SUBGRAPH_URL_MAINNET }} + REACT_APP_SUBGRAPH_URL_GNOSIS_CHAIN=${{ secrets.REACT_APP_SUBGRAPH_URL_GNOSIS_CHAIN }} + REACT_APP_SUBGRAPH_URL_GOERLI=${{ secrets.REACT_APP_SUBGRAPH_URL_GOERLI }} vercel build -t ${{ secrets.VERCEL_TOKEN }} --prod - name: Get the version diff --git a/apps/explorer/.env.example b/apps/explorer/.env.example index e3bb230873..e3ffb9a9c4 100644 --- a/apps/explorer/.env.example +++ b/apps/explorer/.env.example @@ -8,9 +8,7 @@ AUTOCONNECT=true REACT_APP_IPFS_READ_URI=https://cloudflare-ipfs.com/ipfs # Sentry -#REACT_APP_SENTRY_DSN='https://' -#REACT_APP_SENTRY_TRACES_SAMPLE_RATE="1.0" -#REACT_APP_SENTRY_AUTH_TOKEN='' +#REACT_APP_EXPLORER_SENTRY_DSN='https://' # Orderbook API Endpoints #REACT_APP_ORDER_BOOK_URLS='{"1":"https://YOUR_HOST","100":"https://YOUR_HOST","5":"https://YOUR_HOST"} diff --git a/apps/explorer/src/components/analytics/index.ts b/apps/explorer/src/components/analytics/index.ts index 0aeb3e2aa8..b04821e3e1 100644 --- a/apps/explorer/src/components/analytics/index.ts +++ b/apps/explorer/src/components/analytics/index.ts @@ -8,7 +8,7 @@ import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals' import GoogleAnalyticsProvider from './GoogleAnalyticsProvider' -const GOOGLE_ANALYTICS_ID: string | undefined = process.env.GOOGLE_ANALYTICS_ID +const GOOGLE_ANALYTICS_ID: string | undefined = process.env.REACT_APP_EXPLORER_GOOGLE_ANALYTICS_ID export const GOOGLE_ANALYTICS_CLIENT_ID_STORAGE_KEY = 'ga_client_id' const storedClientId = window.localStorage.getItem(GOOGLE_ANALYTICS_CLIENT_ID_STORAGE_KEY) diff --git a/apps/explorer/src/explorer/ExplorerApp.tsx b/apps/explorer/src/explorer/ExplorerApp.tsx index a70f1c7708..94224e663c 100644 --- a/apps/explorer/src/explorer/ExplorerApp.tsx +++ b/apps/explorer/src/explorer/ExplorerApp.tsx @@ -18,7 +18,7 @@ import { NetworkUpdater } from '../state/network/NetworkUpdater' import { NETWORK_OPTIONS } from '../consts/network' import { RedirectMainnet, RedirectXdai } from '../state/network' -const SENTRY_DSN = process.env.REACT_APP_SENTRY_DSN +const SENTRY_DSN = process.env.REACT_APP_EXPLORER_SENTRY_DSN const SENTRY_TRACES_SAMPLE_RATE = process.env.REACT_APP_SENTRY_TRACES_SAMPLE_RATE if (SENTRY_DSN) {