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
name: Release
on:
# crates.io trusted publishing rejects OIDC tokens minted under
# `workflow_run`, so publishing runs on the `main` push itself — which
# can only come from a merged pull request (conventionally the dev ->
# main release PR) whose required checks already passed on the same
# tree. `release-pr` still waits for CI via `workflow_run`.
push:
branches:
workflow_run:
workflows:
branches:
types:
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release:
name: Release unpublished packages
runs-on: ubuntu-latest
if: github.event_name == 'push'
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: ./.github/actions/setup-rust
with:
cache: "false"
# `cargo publish` verifies each package by building it with its default
# features, so the native libraries the workspace links have to be here
# as they are in the test workflow: without them the Linux-only
# `cros-libva` build script, reached through `waterkit-codec`, fails the
# `waterui-image` verify build on the missing `libva-dev`.
- uses: ./.github/actions/setup-linux-deps
# Mint a short-lived crates.io token from the GitHub OIDC identity
# instead of a stored CARGO_REGISTRY_TOKEN (trusted publishing is
# configured per crate on crates.io).
- uses: rust-lang/crates-io-auth-action@v1
id: crates-io-auth
- uses: ./.github/actions/release-plz
id: release_plz
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
# Read the tag out of release-plz's own report rather than looking for
# one on this job's HEAD. The tags do not land there: releasing 0.4.1
# created `v0.4.1` on the release branch's tip, while this
# job had the merge commit checked out, so `git tag --points-at HEAD`
# finds nothing even when a release published perfectly well (#540).
# The `v<version>` tag release-plz published for the `waterui` facade
# names the framework release `water create --channel stable` resolves.
# No facade release this run means no framework manifest to publish.
- name: Detect framework release tag
id: framework_tag
shell: bash
env:
REPORT: ${{ steps.release_plz.outputs.report }}
run: |
set -euo pipefail
FRAMEWORK_TAG="$(jq -r '[.releases[]? | select(.package_name == "waterui") | .tag] | last // ""' <<< "$REPORT")"
echo "framework_tag=${FRAMEWORK_TAG}" >> "$GITHUB_OUTPUT"
if [[ -n "${FRAMEWORK_TAG}" ]]; then
echo "release-plz released the framework as ${FRAMEWORK_TAG}."
else
echo "release-plz released no waterui facade this run."
fi
# The manifest is built from the tagged tree itself: the script checks
# the tag out and records that revision's scaffold table and lock.
- name: Publish the stable framework manifest
if: steps.framework_tag.outputs.framework_tag != ''
env:
GH_TOKEN: ${{ github.token }}
FRAMEWORK_TAG: ${{ steps.framework_tag.outputs.framework_tag }}
run: |
set -euo pipefail
python3 .github/scripts/framework_manifest.py stable --tag "$FRAMEWORK_TAG"
gh release upload "$FRAMEWORK_TAG" framework.json --clobber
release-pr:
name: Prepare the next release
runs-on: ubuntu-latest
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main'
concurrency:
group: release-plz-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: ./.github/actions/setup-rust
with:
cache: "false"
# The same native libraries as above: computing the next versions also
# builds the workspace's metadata against every crate's dependencies.
- uses: ./.github/actions/setup-linux-deps
- uses: ./.github/actions/release-plz
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}