Merge pull request #1958 from CryptoBlades/wcro-metadata #8359
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: Build and Deploy | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check lockfileVersion for root | |
run: | | |
test -f package-lock.json | |
test "$(jq '.lockfileVersion' package-lock.json)" -eq 2 | |
- name: Check lockfileVersion for frontend | |
run: | | |
test -f frontend/package-lock.json | |
test "$(jq '.lockfileVersion' frontend/package-lock.json)" -eq 2 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16.14.0" | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run validate-migrations | |
- name: Setup frontend for testnet | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/testnet' }} | |
run: node scripts/ci-setup-frontend-for-testnet.js | |
- name: Setup frontend for mainnet | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/production' }} | |
run: node scripts/ci-setup-frontend-for-mainnet.js | |
- name: Build smart contracts | |
run: npm run contract:prepare | |
- run: npm run build:frontend | |
env: | |
NODE_OPTIONS: "--max-old-space-size=8192" | |
- name: Deploy testnet frontend | |
uses: netlify/actions/cli@375963b92b795c7b979927c580dd6f2a65ebcf28 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/testnet' }} | |
with: | |
args: deploy --dir=frontend/dist --prod | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_TESTNET_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
- name: Deploy mainnet frontend | |
uses: netlify/actions/cli@375963b92b795c7b979927c580dd6f2a65ebcf28 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/production' }} | |
with: | |
args: deploy --dir=frontend/dist --prod | |
env: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_MAINNET_SITE_ID }} | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |