chore: add env vars for Explorer #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Vercel | ||
on: | ||
workflow_call: | ||
inputs: | ||
env_name: | ||
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 }} | ||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
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[format('VERCEL_PROJECT_ID_{0}', matrix.project_suffix)] }}" >> $GITHUB_ENV | ||
- name: Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
- name: Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | ||
- 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 }} | ||
REACT_APP_BLOCKNATIVE_API_KEY=${{ secrets.REACT_APP_BLOCKNATIVE_API_KEY }} | ||
REACT_APP_GOOGLE_ANALYTICS_ID=${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID }} | ||
REACT_APP_LAUNCH_DARKLY_KEY=${{ secrets.REACT_APP_LAUNCH_DARKLY_KEY }} | ||
REACT_APP_INFURA_KEY=${{ secrets.REACT_APP_INFURA_KEY }} | ||
REACT_APP_NETWORK_URL_1=${{ secrets.REACT_APP_NETWORK_URL_1 }} | ||
REACT_APP_NETWORK_URL_100=${{ secrets.REACT_APP_NETWORK_URL_100 }} | ||
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_SENTRY_DSN=${{ secrets.SENTRY_DSN }} | ||
REACT_APP_SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | ||
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 | ||
id: get_version | ||
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT | ||
- name: Deploy Project Artifacts to Vercel | ||
run: > | ||
vercel deploy --prebuilt --prod | ||
-t ${{ secrets.VERCEL_TOKEN }} | ||
-m VERSION=${{ steps.get_version.outputs.VERSION }} | ||
-m COMMIT=${{ github.sha }} |