-
Notifications
You must be signed in to change notification settings - Fork 373
482 lines (420 loc) · 16.9 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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: "What kind of release is this?"
type: choice
options:
- alpha
- rc
- final
required: true
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
permissions: # wants to push commits and create a PR
contents: write
id-token: write
jobs:
# Re-entrancy:
# - `version` is re-entrant because it doesn't commit/create PR if the version doesn't change,
# and the version doesn't change if we're already on the final version specified by the branch name.
# - `update-docs` is re-entrant because it overwrites history of the `gh-pages` branch, so any
# previous partial update will just be overwritten by the next successful run.
# - `publish-crates` is re-entrant because the `crates.py` script correctly handles publish failures
# by first checking if a crate has already been published before attempting to publish it.
# - `build-and-publish-wheels` is re-entrant because all the uploaded artifacts will be overwritten
# by any subsequent runs, and the final upload to PyPI has the `--skip-existing` flag, which ignores
# any wheels already uploaded.
# - `build-and-publish-web` is re-entrant for the same reason as `build-and-publish-wheels`,
# except that uploads are done to GCS instead of PyPI.
checks:
name: "Checks"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
# TODO(emilk): We want to forbid `?speculative-link` just _after_ a release…
# - name: Check links for `?speculative-link`
# # NOTE: We allow `?speculative-link` only in alpha releases
# run: |
# if [ ${{ inputs.release-type }} != "alpha" ]; then
# python3 scripts/ci/check_links.py
# fi
version:
name: "Versioning"
runs-on: ubuntu-latest
needs: [checks]
outputs:
previous: ${{ steps.versioning.outputs.previous }}
current: ${{ steps.versioning.outputs.current }}
final: ${{ steps.versioning.outputs.final }}
# will be set to `github.sha` if the pull request already exists
# this is the last (and not merge) commit in the release branch
release-commit: ${{ steps.commit.outputs.version_bump_commit_sha || github.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RERUN_BOT_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install deps
shell: bash
run: |
python3 -m pip install -r ./scripts/ci/requirements-crates.txt
- uses: prefix-dev/setup-pixi@v0.4.1
with:
pixi-version: v0.13.0
- name: Update crate versions
id: versioning
shell: bash
run: |
echo "release_version: $release_version"
echo Parse the release version from the branch name…
# `release-0.8.1-meta.N` -> `0.8.1`
release_version=$(python3 scripts/ci/crates.py get-version --from git --finalize)
echo Store version before the update, so we can later detect if it changed…
previous=$(python3 scripts/ci/crates.py get-version)
echo If the version minus prerelease/build metadata is not the same as the release version, then update it.…
if [ $(python3 scripts/ci/crates.py get-version --finalize) != $release_version ]; then
python3 scripts/ci/crates.py version --exact $release_version
fi
echo If this is an 'rc', additionally set add '-rc.N'. This will also bump the 'N' if '-rc.N' is already set…
if [ ${{ inputs.release-type }} = "rc" ]; then
python3 scripts/ci/crates.py version --bump prerelease --pre-id=rc
fi
echo If this is an 'alpha', set the version to whatever is in the git branch name.…
if [ ${{ inputs.release-type }} = "alpha" ]; then
python3 scripts/ci/crates.py version --exact $(python3 scripts/ci/crates.py get-version --from git)
fi
echo If this is a 'final', set the version to the final release version…
if [ ${{ inputs.release-type }} = "final" ]; then
python3 scripts/ci/crates.py version --exact $release_version
fi
echo Store version after the update, and the expected "final" release version…
current=$(python3 scripts/ci/crates.py get-version)
final=$(python3 scripts/ci/crates.py get-version --finalize)
echo Output everything for use in other steps…
echo "previous=$previous" >> "$GITHUB_OUTPUT"
echo "current=$current" >> "$GITHUB_OUTPUT"
echo "final=$final" >> "$GITHUB_OUTPUT"
- name: Update JS package versions
shell: bash
run: |
pixi run node rerun_js/scripts/version.mjs "${{ steps.versioning.outputs.current }}"
- name: Update rerun_c version
shell: bash
# Configuring CMake is enough to change the version on rerun.h!
run: |
cmake -B build -S .
- run: pixi run toml-fmt
shell: bash
- name: Commit new version
id: commit
if: steps.versioning.outputs.previous != steps.versioning.outputs.current
shell: bash
run: |
git pull
git config --global user.name "rerun-bot"
git config --global user.email "bot@rerun.io"
git commit -am "Bump versions to ${{ steps.versioning.outputs.current }}"
git push
echo "version_bump_commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
shell: bash
run: |
set +e
pr=$(gh pr view --json headRefName 2>/dev/null || echo "{}")
if echo "$pr" | jq '. | has("headRefName")' | grep -q 'true'; then
echo "PR already exists"
exit 0
fi
set -e
echo "PR does not exist, creating…"
cat <<EOF > pr-body.txt
### Next steps
- Test the release
- If this is an 'alpha' release, you can just merge the pull request.
- Otherwise:
- For any added commits, run the release workflow in 'rc' mode again
- After testing, run the release workflow in 'release' mode
- Once the final release workflow finishes it will create a GitHub release for you. Then:
- [ ] Sanity check the build artifacts:
- [ ] pip install: does it install and run?
- [ ] cargo install of cli tool: does it install and run?
- [ ] C++ SDK zip: does it contain rerun_c for all platforms?
- [ ] Populate the release with the changelog and a nice header video/picture, check `Set as latest release`, then click `Publish release`.
- [ ] Make sure the [conda feedstock PR](https://github.com/conda-forge/rerun-sdk-feedstock/pulls) gets
merged. This will be created by the `regro-cf-autotick-bot` once the GitHub release is created.
- [ ] Update the [google colab notebooks](https://drive.google.com/drive/folders/0AC0q24MFKh3fUk9PVA) to install this version and re-execute the notebook.
- [ ] Tests
- [ ] Windows
- [ ] Linux
- [ ] MacOS
EOF
gh pr create \
--base main \
--head $(git branch --show-current) \
--title "Release ${{ (inputs.release-type == 'alpha' && steps.versioning.outputs.current) || steps.versioning.outputs.final }}" \
--label "⛴ release" \
--label "exclude from changelog" \
--fill \
--body-file pr-body.txt
update-docs:
name: "Update Docs"
needs: [version]
uses: ./.github/workflows/reusable_deploy_docs.yml
with:
CONCURRENCY: ${{ github.ref_name }}
PY_DOCS_VERSION_NAME: ${{ inputs.release-type == 'final' && needs.version.outputs.final || 'dev' }}
CPP_DOCS_VERSION_NAME: ${{ inputs.release-type == 'final' && 'stable' || 'dev' }}
RS_DOCS_VERSION_NAME: ${{ inputs.release-type == 'final' && 'stable' || 'dev' }}
RELEASE_COMMIT: ${{ needs.version.outputs.release-commit }}
RELEASE_VERSION: ${{ needs.version.outputs.final }}
UPDATE_LATEST: ${{ inputs.release-type == 'final' }}
secrets: inherit
publish-crates:
name: "Publish Crates"
needs: [version]
uses: ./.github/workflows/reusable_release_crates.yml
with:
CONCURRENCY: ${{ github.ref_name }}
RELEASE_COMMIT: ${{ needs.version.outputs.release-commit }}
secrets: inherit
publish-wheels:
name: "Build and Publish Wheels"
needs: [version]
uses: ./.github/workflows/reusable_publish_wheels.yml
with:
release-version: ${{ needs.version.outputs.current }}
concurrency: ${{ github.ref_name }}
linux-wheel-name: linux-wheel
release-commit: ${{ needs.version.outputs.release-commit }}
secrets: inherit
publish-web:
name: "Build and Publish Web"
needs: [version, publish-wheels]
uses: ./.github/workflows/reusable_publish_web.yml
with:
release-version: ${{ needs.version.outputs.current }}
release-commit: ${{ needs.version.outputs.release-commit }}
concurrency: ${{ github.ref_name }}
wheel-artifact-name: linux-wheel
update-latest: ${{ inputs.release-type == 'final' }}
secrets: inherit
publish-rerun_c:
name: "Build and Publish rerun_c"
needs: [version]
uses: ./.github/workflows/reusable_publish_rerun_c.yml
with:
release-version: ${{ needs.version.outputs.current }}
release-commit: ${{ needs.version.outputs.release-commit }}
concurrency: ${{ github.ref_name }}
secrets: inherit
publish-rerun-cli:
name: "Publish rerun-cli"
needs: [version]
uses: ./.github/workflows/reusable_publish_rerun_cli.yml
with:
release-version: ${{ needs.version.outputs.current }}
release-commit: ${{ needs.version.outputs.release-commit }}
concurrency: ${{ github.ref_name }}
secrets: inherit
publish-js:
name: "Publish JS"
needs: [version]
uses: ./.github/workflows/reusable_publish_js.yml
with:
release-commit: ${{ needs.version.outputs.release-commit }}
concurrency: ${{ github.ref_name }}
secrets: inherit
update-latest-branch:
name: "Update Latest Branch"
if: inputs.release-type == 'final'
needs:
[
version,
update-docs,
publish-crates,
publish-wheels,
publish-web,
publish-rerun_c,
publish-rerun-cli,
publish-js,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ needs.version.outputs.release-commit }}
- name: Update latest branch
shell: bash
run: |
git fetch
git checkout ${{ github.ref_name }}
git push --force origin refs/heads/${{ github.ref_name }}:refs/heads/latest
github-release:
name: "GitHub Release"
if: inputs.release-type == 'final'
needs:
[
version,
update-docs,
publish-crates,
publish-wheels,
publish-web,
publish-rerun_c,
publish-rerun-cli,
publish-js,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RERUN_BOT_TOKEN }}
- name: Release tag
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
version="${{ needs.version.outputs.final }}"
commit="${{ needs.version.outputs.release-commit }}"
git tag $version $commit
git push origin $version
gh release create $version --verify-tag --draft --title $version
- name: Create comment
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
run: |
pr_number=$(gh pr view --json number | jq '.number')
version="${{ needs.version.outputs.final }}"
cat <<EOF > comment-body.txt
GitHub release draft: [$version](https://github.com/rerun-io/rerun/releases/tag/$version)
EOF
gh pr comment $pr_number --body-file comment-body.txt
post-release-version-bump:
name: "Post-Release Version Bump"
if: inputs.release-type == 'alpha' || inputs.release-type == 'final'
needs:
[
version,
update-docs,
publish-crates,
publish-wheels,
publish-web,
publish-rerun_c,
publish-rerun-cli,
publish-js,
github-release,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RERUN_BOT_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- uses: prefix-dev/setup-pixi@v0.4.1
with:
pixi-version: v0.13.0
- name: Install dependencies
shell: bash
run: |
python3 -m pip install -r scripts/ci/requirements-crates.txt
- name: Commit new version
shell: bash
run: |
# checkout + pull changes
git config --global user.name "rerun-bot"
git config --global user.email "bot@rerun.io"
git checkout ${{ github.ref_name }}
git pull --rebase
# bump version and commit it
python3 scripts/ci/crates.py version --bump auto
pixi run toml-fmt
version="$(python3 scripts/ci/crates.py get-version)"
git commit -am "Bump versions to $version"
git push
comment-artifact-links:
name: "Link to artifacts"
needs:
[
version,
update-docs,
publish-crates,
publish-wheels,
publish-web,
publish-rerun_c,
publish-rerun-cli,
publish-js,
]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RERUN_BOT_TOKEN }}
- name: Create comment
env:
GH_TOKEN: ${{ secrets.RERUN_BOT_TOKEN }}
shell: bash
run: |
pr_number=$(gh pr view --json number | jq '.number')
echo "pr_number: $pr_number"
short_commit_hash=$(echo ${{ needs.version.outputs.release-commit }} | cut -c1-7)
if [ ${{ inputs.release-type }} = "final" ]; then
web_app_link="https://app.rerun.io/version/${{ needs.version.outputs.final }}"
rerun_io_docs_link="https://rerun.io/docs"
py_docs_link="https://ref.rerun.io/docs/python/${{ needs.version.outputs.final }}"
else
web_app_link="https://app.rerun.io/commit/$short_commit_hash"
rerun_io_docs_link="https://rerun.io/preview/$short_commit_hash/docs"
py_docs_link="https://ref.rerun.io/docs/python/dev"
fi
wheels_link="https://pypi.org/project/rerun-sdk/${{ needs.version.outputs.current }}"
crates_link="https://crates.io/crates/rerun/${{ needs.version.outputs.current }}"
npm_link="https://www.npmjs.com/package/@rerun-io/web-viewer/v/${{ needs.version.outputs.current }}"
rs_docs_link="https://docs.rs/rerun/${{ needs.version.outputs.current }}"
cpp_sdk_zip_link="https://build.rerun.io/commit/$short_commit_hash/rerun_cpp_sdk.zip"
pip_install="pip install rerun-sdk==${{ needs.version.outputs.current }}"
cargo_install="cargo install rerun-cli@${{ needs.version.outputs.current }}"
npm_install="npm install @rerun-io/web-viewer@${{ needs.version.outputs.current }}"
cat <<EOF > comment-body.txt
Version ${{ needs.version.outputs.current }} published successfully.
| artifact | install |
| --------------------------------- | -------------- |
| [web app]($web_app_link) | |
| [wheels]($wheels_link) | $pip_install |
| [crates]($crates_link) | $cargo_install |
| [npm]($npm_link) | $npm_install |
| [docs]($rerun_io_docs_link) | |
| [py docs]($py_docs_link) | |
| [rs docs]($rs_docs_link) | |
| [cpp_sdk zip]($cpp_sdk_zip_link) | |
EOF
gh pr comment $pr_number --body-file comment-body.txt