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
# The man pages and the manual's title page carry the crate version, and
# release-plz bumps the manifest without ever building the crate, so every
# release PR arrives with those files a version behind and CI red. Regenerating
# them by hand was a step easy to forget and easy to get wrong, so this does it.
#
# The push uses RELEASE_PLZ_TOKEN rather than GITHUB_TOKEN: a push made with the
# built-in token does not start another workflow run, which would leave the PR
# showing the failed checks from before the fix. Pushing as a real identity
# re-runs CI against the corrected commit — and therefore re-runs this job, so
# it must reach a fixed point rather than a loop. Two things ensure that: the
# manual is built with a fixed SOURCE_DATE_EPOCH, without which Typst's
# timestamp and random instance id make every rebuild a fresh diff, and the
# guard below refuses to act on a commit this job already made.
name: Release assets
on:
pull_request:
branches:
- main
permissions:
contents: read
env:
MESSAGE: "chore: regenerate the versioned artefacts"
jobs:
regenerate:
if: startsWith(github.head_ref, 'release-plz-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
- uses: typst-community/setup-typst@v5
with:
typst-version: 0.15.1
- id: guard
run: |
if [ "$(git log -1 --format=%s)" = "$MESSAGE" ]; then
echo "run=false" >> "$GITHUB_OUTPUT"
else
echo "run=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.guard.outputs.run == 'true'
env:
SOURCE_DATE_EPOCH: "0"
run: |
cargo run --locked --quiet -p xtask
typst compile --root . docs/manual.typ docs/manual.pdf
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then exit 0; fi
git commit -m "$MESSAGE"
git push