77 branches :
88 - main
99 pull_request :
10+ # We intend to use `workflow dispatch` in two different situations/paths:
11+ # 1. If a workflow will be manually dspatched from branch named
12+ # `dapp-development`, workflow will deploy the contracts on the selected
13+ # testnet and publish them to NPM registry with `dapp-dev-<environment>`
14+ # suffix and `dapp-development-<environment>` tag. Such packages are meant
15+ # to be used locally by the team developing Threshold Token dApp and may
16+ # contain contracts that have different values from the ones used on
17+ # mainnet.
18+ # 2. If a workflow will be manually dspatched from a branch which name is not
19+ # `dapp-development`, the workflow will deploy the contracts on the
20+ # selected testnet and publish them to NPM registry with `<environment>`
21+ # suffix and tag. Such packages will be used later to deploy public
22+ # Threshold Token dApp on a testnet, with contracts resembling those used
23+ # on mainnet.
1024 workflow_dispatch :
1125 inputs :
1226 environment :
13- description : " Environment for workflow execution"
27+ description : " Environment (network) for workflow execution, e.g. `goerli` "
1428 required : false
15- default : " dev"
1629 upstream_builds :
1730 description : " Upstream builds"
1831 required : false
2740 outputs :
2841 system-tests : ${{ steps.filter.outputs.system-tests }}
2942 steps :
30- - uses : actions/checkout@v2
43+ - uses : actions/checkout@v3
3144 if : github.event_name == 'pull_request'
3245
3346 - uses : dorny/paths-filter@v2
4255 contracts-build-and-test :
4356 runs-on : ubuntu-latest
4457 steps :
45- - uses : actions/checkout@v2
58+ - uses : actions/checkout@v3
4659
47- - uses : actions/setup-node@v2
60+ - uses : actions/setup-node@v3
4861 with :
4962 node-version : " 14.x"
5063 cache : " yarn"
@@ -56,16 +69,19 @@ jobs:
5669 run : yarn build
5770
5871 - name : Run tests
72+ if : github.ref != 'refs/heads/dapp-development'
5973 run : yarn test
6074
6175 contracts-system-tests :
6276 needs : contracts-detect-changes
63- if : needs.contracts-detect-changes.outputs.system-tests == 'true'
77+ if : |
78+ needs.contracts-detect-changes.outputs.system-tests == 'true'
79+ && github.ref != 'refs/heads/dapp-development'
6480 runs-on : ubuntu-latest
6581 steps :
66- - uses : actions/checkout@v2
82+ - uses : actions/checkout@v3
6783
68- - uses : actions/setup-node@v2
84+ - uses : actions/setup-node@v3
6985 with :
7086 node-version : " 14.x"
7187 cache : " yarn"
84100 contracts-deployment-dry-run :
85101 runs-on : ubuntu-latest
86102 steps :
87- - uses : actions/checkout@v2
103+ - uses : actions/checkout@v3
88104
89- - uses : actions/setup-node@v2
105+ - uses : actions/setup-node@v3
90106 with :
91107 node-version : " 14.x"
92108 cache : " yarn"
@@ -99,12 +115,14 @@ jobs:
99115
100116 contracts-deployment-testnet :
101117 needs : [contracts-build-and-test]
102- if : github.event_name == 'workflow_dispatch'
118+ if : |
119+ github.event_name == 'workflow_dispatch'
120+ && github.ref != 'refs/heads/dapp-development'
103121 runs-on : ubuntu-latest
104122 steps :
105- - uses : actions/checkout@v2
123+ - uses : actions/checkout@v3
106124
107- - uses : actions/setup-node@v2
125+ - uses : actions/setup-node@v3
108126 with :
109127 node-version : " 14.x"
110128 cache : " yarn"
@@ -154,7 +172,7 @@ jobs:
154172 version : ${{ steps.npm-version-bump.outputs.version }}
155173
156174 - name : Upload files needed for etherscan verification
157- uses : actions/upload-artifact@v2
175+ uses : actions/upload-artifact@v3
158176 with :
159177 name : Artifacts for etherscan verifcation
160178 path : |
@@ -166,14 +184,14 @@ jobs:
166184 needs : [contracts-deployment-testnet]
167185 runs-on : ubuntu-latest
168186 steps :
169- - uses : actions/checkout@v2
187+ - uses : actions/checkout@v3
170188
171189 - name : Download files needed for etherscan verification
172- uses : actions/download-artifact@v2
190+ uses : actions/download-artifact@v3
173191 with :
174192 name : Artifacts for etherscan verifcation
175193
176- - uses : actions/setup-node@v2
194+ - uses : actions/setup-node@v3
177195 with :
178196 node-version : " 14.x"
179197 cache : " yarn"
@@ -196,20 +214,80 @@ jobs:
196214 yarn run hardhat --network ${{ github.event.inputs.environment }} \
197215 etherscan-verify --license GPL-3.0 --force-license
198216
217+ # This job is responsible for publishing packages from `dapp-development`
218+ # branch, which are slightly modified to help with the process of testing some
219+ # features on the Threshold Token dApp. The job starts only if workflow gets
220+ # triggered by the `workflow_dispatch` event on the branch `dapp-development`.
221+ contracts-dapp-development-deployment-testnet :
222+ needs : [contracts-build-and-test]
223+ if : |
224+ github.event_name == 'workflow_dispatch'
225+ && github.ref == 'refs/heads/dapp-development'
226+ runs-on : ubuntu-latest
227+ steps :
228+ - uses : actions/checkout@v3
229+
230+ - uses : actions/setup-node@v3
231+ with :
232+ node-version : " 14.x"
233+ cache : " yarn"
234+ registry-url : " https://registry.npmjs.org"
235+
236+ - name : Install dependencies
237+ run : yarn install --frozen-lockfile
238+
239+ - name : Resolve latest contracts
240+ run : yarn upgrade @keep-network/keep-core@${{ github.event.inputs.environment }}
241+
242+ - name : Deploy contracts
243+ env :
244+ CHAIN_API_URL : ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
245+ CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY : ${{ secrets.DAPP_DEV_GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
246+ KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY : ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
247+ run : yarn deploy --network ${{ github.event.inputs.environment }}
248+
249+ - name : Bump up package version
250+ id : npm-version-bump
251+ uses : keep-network/npm-version-bump@v2
252+ with :
253+ environment : dapp-dev-${{ github.event.inputs.environment }}
254+ branch : ${{ github.ref }}
255+ commit : ${{ github.sha }}
256+
257+ - name : Publish to npm
258+ env :
259+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
260+ run : |
261+ npm publish --access=public \
262+ --network=${{ github.event.inputs.environment }} \
263+ --tag dapp-development-${{ github.event.inputs.environment }}
264+
265+ - name : Notify CI about completion of the workflow
266+ uses : keep-network/ci/actions/notify-workflow-completed@v2
267+ env :
268+ GITHUB_TOKEN : ${{ secrets.CI_GITHUB_TOKEN }}
269+ with :
270+ module : " github.com/threshold-network/solidity-contracts"
271+ url : https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
272+ environment : ${{ github.event.inputs.environment }}
273+ upstream_builds : ${{ github.event.inputs.upstream_builds }}
274+ upstream_ref : dapp-development
275+ version : ${{ steps.npm-version-bump.outputs.version }}
276+
199277 contracts-slither :
200278 runs-on : ubuntu-latest
201279 if : |
202280 github.event_name != 'workflow_dispatch'
203281 && github.event_name != 'schedule'
204282 steps :
205- - uses : actions/checkout@v2
283+ - uses : actions/checkout@v3
206284
207- - uses : actions/setup-node@v2
285+ - uses : actions/setup-node@v3
208286 with :
209287 node-version : " 14"
210288 cache : " yarn"
211289
212- - uses : actions/setup-python@v2
290+ - uses : actions/setup-python@v4
213291 with :
214292 python-version : 3.8.5
215293
0 commit comments