-
Notifications
You must be signed in to change notification settings - Fork 15
359 lines (295 loc) · 10.4 KB
/
release.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
name: "release-please"
on:
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releases-created: ${{ steps.release.outputs.releases_created }}
pr: ${{ steps.release.outputs['pr'] }}
air-release-created: ${{ steps.release.outputs['air--release_created'] }}
air-tag-name: ${{ steps.release.outputs['air--tag_name'] }}
air-interpreter-release-created: ${{ steps.release.outputs['air-interpreter--release_created'] }}
air-interpreter-version: ${{ steps.release.outputs['air-interpreter--version'] }}
air-interpreter-tag-name: ${{ steps.release.outputs['air-interpreter--tag_name'] }}
air-beautify-wasm-release-created: ${{ steps.release.outputs['tools/wasm/air-beautify-wasm--release_created'] }}
air-beautify-wasm-tag-name: ${{ steps.release.outputs['tools/wasm/air-beautify-wasm--tag_name'] }}
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
bump-version:
if: needs.release-please.outputs.pr != null
runs-on: builder
needs:
- release-please
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Install cargo-edit
uses: baptiste0928/cargo-install@v3.1.0
with:
crate: cargo-edit
- name: Get air-interpreter version
id: version
run: |
version="$(jq -r '.["air-interpreter"]' .github/release-please/manifest.json)"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Set air-interpreter-wasm version
run: cargo set-version ${{ steps.version.outputs.version }}
working-directory: crates/interpreter-wasm
- name: Set air-near-contract version
run: cargo set-version ${{ steps.version.outputs.version }}
working-directory: tools/wasm/air-near-contract
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Bump air-interpreter and air-near-contract version to ${{ steps.version.outputs.version }}"
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
commit_user_name: fluencebot
commit_user_email: devops@fluence.one
commit_author: fluencebot <devops@fluence.one>
crates:
if: needs.release-please.outputs.releases-created
runs-on: builder
needs:
- release-please
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Import secrets
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Setup marine
uses: fluencelabs/setup-marine@v1
- name: Build air_interpreter_server.wasm
run: marine build --release -p air-interpreter --features marine
working-directory: air-interpreter
- name: Upload air-interpreter-wasm artifact to GitHub checks
uses: actions/upload-artifact@v3
with:
name: air-interpreter-wasm
path: target/wasm32-wasi/release/air_interpreter_server.wasm
- name: Add air-interpreter-wasm artifact to GitHub release
if: needs.release-please.outputs.air-interpreter-release-created
uses: softprops/action-gh-release@v1
with:
files: target/wasm32-wasi/release/air_interpreter_server.wasm
tag_name: ${{ needs.release-please.outputs.air-interpreter-tag-name }}
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v3.1.0
with:
crate: cargo-workspaces
- name: Publish to crates.io
run: |
cargo ws publish \
--no-git-commit \
--allow-dirty \
--from-git \
--skip-published \
--yes
avm-client:
if: needs.release-please.outputs.air-interpreter-release-created
runs-on: builder
needs:
- release-please
- crates
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download air-interpreter-wasm artifact
uses: actions/download-artifact@v3
with:
name: air-interpreter-wasm
path: avm/client/dist/
- run: mv air_interpreter_server.wasm avm.wasm
working-directory: avm/client/dist
- name: Import secrets
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: avm/client/package-lock.json
cache: "npm"
- run: npm i
working-directory: avm/client
- run: npm run build
working-directory: avm/client
- name: Publish to npm registry
run: npm publish --access public
working-directory: avm/client
air-interpreter-wasm:
if: needs.release-please.outputs.air-interpreter-release-created
runs-on: builder
needs:
- release-please
- crates
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Download air-interpreter-wasm artifact
uses: actions/download-artifact@v3
with:
name: air-interpreter-wasm
path: crates/interpreter-wasm/
- name: Import secrets
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN
- name: Publish to crates.io
run: cargo publish --allow-dirty
working-directory: crates/interpreter-wasm
air-beautify-wasm:
if: needs.release-please.outputs.air-beautify-wasm-release-created
runs-on: builder
needs:
- release-please
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
- name: Build wasm
working-directory: tools/wasm/air-beautify-wasm
run: wasm-pack build --release -m force --target nodejs
- name: Import secrets
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- name: Rename package
run: sed -i -e "s/air-beautify-wasm/@fluencelabs\/air-beautify-wasm/" package.json
working-directory: tools/wasm/air-beautify-wasm/pkg
- name: Publish to npm registry
run: npm publish --access public
working-directory: tools/wasm/air-beautify-wasm/pkg
benchmark:
needs: release-please
if: needs.release-please.outputs.air-release-created
uses: ./.github/workflows/benchmark.yml
with:
ref: ${{ github.ref }}
tag: ${{ needs.release-please.outputs.air-tag-name }}
slack:
if: always()
name: "Notify"
runs-on: ubuntu-latest
needs:
- release-please
- crates
- avm-client
- air-interpreter-wasm
- air-beautify-wasm
permissions:
contents: read
id-token: write
steps:
- uses: lwhiteley/dependent-jobs-result-check@v1
id: status
with:
statuses: failure
dependencies: ${{ toJSON(needs) }}
- name: Log output
run: |
echo "statuses:" "${{ steps.status.outputs.statuses }}"
echo "jobs:" "${{ steps.status.outputs.jobs }}"
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
- uses: ravsamhq/notify-slack-action@v2
if: steps.status.outputs.found == 'true'
with:
status: "failure"
notification_title: "*{workflow}* has {status_message}"
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
footer: "<{run_url}>"