6
6
- main
7
7
pull_request :
8
8
workflow_dispatch :
9
+ inputs :
10
+ environment :
11
+ description : ' Environment for workflow execution'
12
+ required : false
13
+ default : ' dev'
14
+ upstream_builds :
15
+ description : " Upstream builds"
16
+ required : false
17
+ upstream_ref :
18
+ description : " Git reference to checkout (e.g. branch name)"
19
+ required : false
20
+ default : " main"
9
21
10
22
jobs :
11
23
contracts-build-and-test :
@@ -27,6 +39,118 @@ jobs:
27
39
- name : Run tests
28
40
run : yarn test
29
41
42
+ contracts-deployment-dry-run :
43
+ runs-on : ubuntu-latest
44
+ if : github.event_name != 'schedule'
45
+ steps :
46
+ - uses : actions/checkout@v2
47
+
48
+ - uses : actions/setup-node@v2
49
+ with :
50
+ node-version : " 14.x"
51
+ cache : " yarn"
52
+
53
+ - name : Install dependencies
54
+ run : yarn install
55
+
56
+ - name : Deploy contracts
57
+ run : yarn deploy
58
+
59
+ contracts-deployment-testnet :
60
+ needs : [contracts-build-and-test]
61
+ if : github.event_name == 'workflow_dispatch'
62
+ runs-on : ubuntu-latest
63
+ steps :
64
+ - uses : actions/checkout@v2
65
+
66
+ - uses : actions/setup-node@v2
67
+ with :
68
+ node-version : " 14.x"
69
+ cache : " yarn"
70
+ registry-url : " https://registry.npmjs.org"
71
+
72
+ - name : Install dependencies
73
+ run : yarn install --frozen-lockfile
74
+
75
+ - name : Get upstream packages versions
76
+ uses : keep-network/ci/actions/upstream-builds-query@v1
77
+ id : upstream-builds-query
78
+ with :
79
+ upstream-builds : ${{ github.event.inputs.upstream_builds }}
80
+ query : keep-core-contracts-version = github.com/keep-network/keep-core/solidity-v1#version
81
+
82
+ - name : Resolve latest contracts
83
+ run : |
84
+ yarn upgrade \
85
+ @keep-network/keep-core@${{ steps.upstream-builds-query.outputs.keep-core-contracts-version }}
86
+
87
+ - name : Configure tenderly
88
+ if : github.event.inputs.environment == 'ropsten'
89
+ env :
90
+ TENDERLY_TOKEN : ${{ secrets.TENDERLY_TOKEN }}
91
+ run : ./config_tenderly.sh
92
+
93
+ - name : Deploy contracts
94
+ env :
95
+ CHAIN_API_URL : ${{ secrets.KEEP_TEST_ETH_HOSTNAME_HTTP }}
96
+ CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY : ${{ secrets.KEEP_TEST_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
97
+ run : yarn deploy --network ${{ github.event.inputs.environment }}
98
+
99
+ - name : Bump up package version
100
+ id : npm-version-bump
101
+ uses : keep-network/npm-version-bump@v2
102
+ with :
103
+ environment : ${{ github.event.inputs.environment }}
104
+ branch : ${{ github.ref }}
105
+ commit : ${{ github.sha }}
106
+
107
+ - name : Publish to npm # TODO: switch off --dry-run
108
+ env :
109
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
110
+ run : npm publish --access=public --network=${{ github.event.inputs.environment }} --dry-run
111
+
112
+ - name : Upload files needed for etherscan verification
113
+ uses : actions/upload-artifact@v2
114
+ with :
115
+ name : Artifacts for etherscan verifcation
116
+ path : |
117
+ ./deployments
118
+ ./package.json
119
+ ./yarn.lock
120
+
121
+ contracts-etherscan-verification :
122
+ needs : [contracts-deployment-testnet]
123
+ runs-on : ubuntu-latest
124
+ steps :
125
+ - uses : actions/checkout@v2
126
+
127
+ - name : Download files needed for etherscan verification
128
+ uses : actions/download-artifact@v2
129
+ with :
130
+ name : Artifacts for etherscan verifcation
131
+
132
+ - uses : actions/setup-node@v2
133
+ with :
134
+ node-version : " 14.x"
135
+ cache : " yarn"
136
+
137
+ - name : Install needed dependencies
138
+ run : yarn install --frozen-lockfile
139
+
140
+ # If we don't remove the `keep-core` contracts from `node-modules`, the
141
+ # `etherscan-verify` plugins tries to verify them, which is not desired.
142
+ - name : Prepare for verification on Etherscan
143
+ run : |
144
+ rm -rf ./node_modules/@keep-network/keep-core
145
+
146
+ - name : Verify contracts on Etherscan
147
+ env :
148
+ ETHERSCAN_API_KEY : ${{ secrets.ETHERSCAN_API_KEY }}
149
+ CHAIN_API_URL : ${{ secrets.KEEP_TEST_ETH_HOSTNAME_HTTP }}
150
+ run : |
151
+ yarn run hardhat --network ${{ github.event.inputs.environment }} \
152
+ etherscan-verify --license MIT
153
+
30
154
contracts-slither :
31
155
runs-on : ubuntu-latest
32
156
steps :
48
172
pip3 install solc-select
49
173
solc-select install $SOLC_VERSION
50
174
solc-select use $SOLC_VERSION
175
+
51
176
- name : Install Slither
52
177
env :
53
178
SLITHER_VERSION : 0.8.0
0 commit comments