Deploy production #35
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 production" | |
"on": | |
workflow_dispatch: | |
inputs: | |
ref: | |
type: string | |
description: "The branch, tag or SHA to checkout" | |
required: true | |
default: "main" | |
preview_env: | |
type: string | |
description: "Test on goerli or mainnet" | |
required: true | |
default: "goerli" | |
jobs: | |
build_and_preview: | |
if: ${{ github.event.repository.full_name == github.repository }} | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: "${{ github.event.inputs.ref }}" | |
- name: "Enable yarn cache" | |
uses: c-hive/gha-yarn-cache@v2 # using cache | |
- name: "Setup node@16" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: "Install dependencies" | |
run: | | |
yarn set version 3.1.1 | |
yarn install | |
- name: "Build: env:${{github.event.inputs.preview_env}} for the preview" | |
run: "yarn run ci:build:${{github.event.inputs.preview_env}}" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: "checkout-dist" | |
path: "public/" | |
if-no-files-found: error # "warn" or "ignore" are also available, defaults to `warn` | |
retention-days: 5 | |
- name: "Setup node@18" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: "Deploy: preview prod-${{github.event.inputs.preview_env}}" | |
uses: matter-labs/action-hosting-deploy@main | |
with: | |
repoToken: "${{secrets.GITHUB_TOKEN}}" | |
firebaseServiceAccount: "${{secrets.FIREBASE_SERVICE_ACCOUNT_ZSYNC_DAPP_CHECKOUT_DEV}}" | |
target: "staging" | |
projectId: zsync-dapp-checkout | |
channelID: "staging_preview" | |
build_and_deploy: | |
if: ${{ github.event.repository.full_name == github.repository }} | |
needs: build_and_preview | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: "${{github.event.inputs.ref}}" | |
- name: "Enable yarn cache" | |
uses: c-hive/gha-yarn-cache@v2 # using cache | |
- name: "Setup node@16" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: "Install dependencies" | |
run: | | |
yarn set version 3.1.1 | |
yarn install | |
- name: "Deploy target: prod-mainnet" | |
run: yarn run ci:build:mainnet | |
- name: "Setup node@18" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- uses: matter-labs/action-hosting-deploy@main | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZSYNC_DAPP_CHECKOUT_PROD }}" | |
target: "prod-mainnet" | |
projectId: zsync-dapp-checkout | |
channelID: live | |
- name: "Setup node@16" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: "Build goerli" | |
run: yarn run ci:build:goerli | |
- name: "Setup node@18" | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- uses: matter-labs/action-hosting-deploy@main | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZSYNC_DAPP_CHECKOUT_PROD }}" | |
target: "prod-goerli" | |
projectId: zsync-dapp-checkout | |
channelID: live |