Deploy to alphaday (production) #26
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: Deploy to alphaday (production) | |
on: | |
workflow_dispatch: | |
env: | |
ENVIRONMENT: production | |
VITE_LOGLEVEL: 2 | |
VITE_API_BASE_URL: https://api.alphaday.com/ | |
VITE_X_APP_ID: sBnL0RkWkM | |
VITE_X_APP_SECRET: 21gPAwU3uOUisMJJFJjaotbDxCmvCHKMh76Xlvb8XK2RkkvZHhtSfcUfoz6QiFx8zhZf31vxvKAFD7pkdmbjHiKwoVuS2iDOLjvC | |
VITE_ZAPPER_BASE_URL: https://api.zapper.fi/v1/ | |
VITE_ZAPPER_BASE_URL_V2: https://api.zapper.fi/v2/ | |
VITE_COINGECKO_BASE_URL: https://api.coingecko.com/api/v3/ | |
VITE_DEFIPULSE_BASE_URL: https://data-api.defipulse.com/api/v1/ | |
VITE_ETHERSCAN_BASE_URL: https://api.etherscan.io/api | |
VITE_ULTRA_SOUND_MONEY_BASE_URL: https://api.ultrasound.money/ | |
VITE_ALPHADAY_IPFS_GATEWAY: https://alphaday.infura-ipfs.io/ipfs/ | |
VITE_SWAP_FEE: 10 | |
VITE_SWAP_FEE_ADDRESS: "0xeb2eCdDF7db14D4Ebca0848F2a879162eb8A43F1" | |
VITE_GA_MEASUREMENT_ID: G-8G37CL2HMF | |
VITE_FIRE_PROJECT_ID: alphaday | |
VITE_FIRE_MEASUREMENT_ID: G-D024QSX252 | |
# alphaday.com site id | |
VITE_HOTJAR_SITE_ID: 3070399 | |
VITE_HOTJAR_SNIPPET_VERSION: 6 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check if necessary ENV variables are set | |
run: | | |
if [ -z "$VITE_OAUTH_ID_GOOGLE" ]; then | |
echo "ERROR: missing google oauth client id" | |
exit 1 | |
fi | |
if [ -z "$VITE_OAUTH_ID_APPLE" ]; then | |
echo "ERROR: missing apple oauth client id" | |
exit 1 | |
fi | |
env: | |
VITE_OAUTH_ID_GOOGLE: ${{ secrets.PROD__REACT_APP_OAUTH_ID_GOOGLE }} | |
VITE_OAUTH_ID_APPLE: ${{ secrets.PROD__FRONTEND__OAUTH_ID_APPLE }} | |
- name: Set tag ENV | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20.11.0" | |
cache: "yarn" | |
cache-dependency-path: | | |
yarn.lock | |
- name: yarn install | |
run: yarn --ignore-engines | |
- name: build | |
run: yarn build:deploy | |
env: | |
VITE_ENVIRONMENT: ${{ env.ENVIRONMENT }} | |
VITE_STORAGE_BUCKET_URL: ${{ secrets.PROD__FRONTEND__STORAGE_BUCKET_URL }} | |
VITE_DEFIPULSE_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_DEFIPULSE }} | |
VITE_ETHERSCAN_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ETHERSCAN }} | |
VITE_ETHPLORER_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ETHPLORER }} | |
VITE_ZAPPER_API_KEY: ${{ secrets.PROD__FRONTEND__API_KEY_ZAPPER }} | |
VITE_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PROD__REACT_APP_WALLET_CONNECT_PROJECT_ID }} | |
VITE_FIRE_API_KEY: ${{ secrets.PROD__REACT_APP_FIRE_API_KEY }} | |
VITE_FIRE_AUTH_DOMAIN: ${{ secrets.PROD__REACT_APP_FIRE_AUTH_DOMAIN }} | |
VITE_FIRE_STORAGE_BUCKET: ${{ secrets.PROD__REACT_APP_FIRE_STORAGE_BUCKET }} | |
VITE_FIRE_MESSAGE_SENDER_ID: ${{ secrets.PROD__REACT_APP_FIRE_MESSAGE_SENDER_ID }} | |
VITE_FIRE_APP_ID: ${{ secrets.PROD__REACT_APP_FIRE_APP_ID }} | |
VITE_SENTRY_DSN: ${{ secrets.PROD__VITE_SENTRY_DSN }} | |
VITE_OAUTH_ID_GOOGLE: ${{ secrets.PROD__REACT_APP_OAUTH_ID_GOOGLE }} | |
VITE_OAUTH_ID_APPLE: ${{ secrets.PROD__FRONTEND__OAUTH_ID_APPLE }} | |
VITE_CLARITY_PROJECT_ID: ${{ secrets.PROD__FRONTEND__CLARITY_PROJECT_ID }} | |
VITE_CLARITY_MOBILE_PROJECT_ID: ${{ secrets.PROD__FRONTEND__CLARITY_MOBILE_PROJECT_ID }} | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
# deploy: sync to s3 and invalidate cloudfront cache | |
- name: deploy | |
uses: kefranabg/s3-sync-action@master # https://github.com/kefranabg/s3-sync-action | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.DEPLOYER__AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEPLOYER__SECRET_ACCESS_KEY }} | |
AWS_S3_BUCKET: ${{ secrets.PROD__FRONTEND__S3_BUCKET }} | |
DISTRIBUTION_ID: ${{ secrets.PROD__FRONTEND__DISTRIBUTION_ID }} | |
AWS_REGION: "eu-west-1" # optional: defaults to us-east-1 | |
SOURCE_DIR: "dist" | |
set-cache-control: | |
uses: ./.github/workflows/set-cache-control.yml | |
needs: deploy | |
if: needs.deploy.result == 'success' | |
with: | |
ENVIRONMENT: alpha | |
VALUE: "no-cache" | |
secrets: inherit | |
# Get message VARs and Notify team through discord of deployment | |
notify: | |
name: Notify | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: needs.deploy.result == 'success' | |
steps: | |
- uses: actions/checkout@v2.2.0 | |
with: | |
fetch-depth: 0 | |
- name: Get Repo Name | |
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
- name: "Get Latest Tag" | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
# Notify Discord | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK__OPS_CHANNEL }} | |
uses: "Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9" | |
with: | |
args: "${{ env.REPOSITORY_NAME }}-${{ steps.previoustag.outputs.tag }} (${{ github.event.pull_request.title }}) has been deployed on ${{ env.ENVIRONMENT }}." |