Skip to content

Main to develop

Main to develop #311

name: Contracts Deploy
on:
pull_request:
types:
- closed
branches:
- 'develop'
- 'main'
paths:
- 'packages/contracts/**'
- '.github/workflows/contracts-deploy.yml'
- '.github/helpers/contracts/**'
jobs:
test:
if: github.actor != 'arabot-1' && github.event.pull_request.merged && contains(toJson(github.event.pull_request.labels.*.name), 'release:')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Compile
run: cd packages/contracts && yarn run build
- name: Run Hardhat Tests
env:
REPORT_GAS: true
run: cd packages/contracts && yarn run test
prepare:
needs: [test]
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.prepare.outputs.environment }}
matrix: ${{ steps.prepare.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Prepare
id: prepare
run: node .github/helpers/contracts/prepare.js '${{ github.ref }}'
build-deploy:
runs-on: ubuntu-latest
needs: [prepare]
environment: ${{ needs.prepare.outputs.environment }}
strategy:
fail-fast: true
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Compile
run: cd packages/contracts && yarn run build
- name: Register Random ENS Subdomain
if: matrix.network == 'goerli'
run: node .github/helpers/contracts/register-ens-subdomain.js dao plugin-${{ github.run_number }}-${{ github.run_id }} 0xE264d5bb84bA3b8061ADC38D3D76e6674aB91852
env:
ENS_REGISTRY: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'
ETH_KEY: ${{ secrets.ETH_KEY }}
NETWORK: ${{ matrix.network }}
- name: Deploy
run: cd packages/contracts && yarn run deploy --network "$NETWORK"
env:
ETH_KEY: ${{ secrets.ETH_KEY }}
NETWORK: ${{ matrix.network }}
GOERLI_DAO_ENS_DOMAIN: dao.eth
GOERLI_PLUGIN_ENS_DOMAIN: 'plugin-${{ github.run_number }}-${{ github.run_id }}.dao.eth'
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
POLYGONSCAN_KEY: ${{ secrets.POLYGONSCAN_KEY }}
- uses: actions/upload-artifact@v2
with:
name: ${{matrix.network}}
path: ./packages/contracts/deployments/*
retention-days: 1
conclude:
runs-on: ubuntu-latest
outputs:
commitid: ${{ steps.commit.outputs.commitid }}
needs: ['build-deploy']
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.ARABOT_PAT }}
- uses: actions/download-artifact@v3
with:
path: artefacts
- name: Update Releases.md
run: node .github/helpers/contracts/updateReleasesMD.js
- name: Update active_contracts.json
run: node .github/helpers/contracts/updateActiveContractsJSON.js
- name: Update Subgraph manifests
run: node .github/helpers/subgraph/updateManifest.js
- name: Commit changes
id: commit
run: |
git fetch
git pull
git config --global user.name "Arabot-1"
git config --global user.email "[email protected]"
git add active_contracts.json
git add packages/contracts/Releases.md
git add ./packages/subgraph/
git commit -am "Updates files with deployed contract addresses"
git push
echo "commitid=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
#call-create-daos-workflow:
# needs: ['conclude']
# uses: './.github/workflows/create-dummy-dao.yml'
# with:
# last_commit: ${{ needs.conclude.outputs.commitid }}
# secrets:
# ETH_KEY: ${{ secrets.ETH_KEY }}
# ARABOT_PAT: ${{ secrets.ARABOT_PAT }}
npm-release:
needs: ['conclude']
uses: './.github/workflows/npm-release-reusable.yml'
with:
ref: ${{ needs.conclude.outputs.commitid }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
ARABOT_PAT: ${{ secrets.ARABOT_PAT }}