-
Notifications
You must be signed in to change notification settings - Fork 43
130 lines (129 loc) · 4.43 KB
/
contracts-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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 }}