130 lines
6.2 KiB
Markdown
130 lines
6.2 KiB
Markdown
|
|
# Releasing OnionWire
|
||
|
|
|
||
|
|
Policy and procedure for cutting a release. Read
|
||
|
|
[`README.md`](../README.md#releases-maintainers) for the short version.
|
||
|
|
|
||
|
|
## Policy: manual, batched releases
|
||
|
|
|
||
|
|
A merge does **not** publish anything. Neither does a tag push.
|
||
|
|
|
||
|
|
A release happens when a **batch of work has reached a stopping point**, chosen
|
||
|
|
by hand:
|
||
|
|
|
||
|
|
- CI is green on `main` (the `ci` workflow passed for the last push), and
|
||
|
|
- the feature set you mean to ship has landed — not a half-merged stack,
|
||
|
|
not a branch you are about to rewrite, and
|
||
|
|
- you are ready to answer user reports against the version you are about to
|
||
|
|
stamp.
|
||
|
|
|
||
|
|
Everything else about the pipeline is unchanged: both architectures, one
|
||
|
|
tagged release, `.sha256` for every asset, the fail-closed "delete the tag we
|
||
|
|
created if the build or publish fails", and the dry-run path.
|
||
|
|
|
||
|
|
## Procedure
|
||
|
|
|
||
|
|
1. **Confirm the stopping point.** `main` is the commit you want to release,
|
||
|
|
its CI run is green, and nothing you intend to include is still in an open
|
||
|
|
PR. The release workflow packages whatever `main`'s head is when the tag is
|
||
|
|
created.
|
||
|
|
2. **Dry-run it.** Actions → **release** → *Run workflow*, `dry_run=true`.
|
||
|
|
That builds and checksums both Linux binaries with no tag and no publish,
|
||
|
|
so it proves the pipeline without stamping a version. (A dry run does not
|
||
|
|
build the Android APK — there is no tag, so nothing wakes
|
||
|
|
`android-release`.)
|
||
|
|
3. **Cut the release.** Actions → **release** → *Run workflow* with
|
||
|
|
`dry_run=false` (the default) and the bump you want. The version must not
|
||
|
|
already be tagged.
|
||
|
|
4. **Watch it.** The run name is `release`; `scripts/watch-release-run.sh`
|
||
|
|
reports job status (it reads `action_run`/`action_run_job` on the Pi's
|
||
|
|
database, so it works for dispatched runs as well as any other).
|
||
|
|
5. **Check the assets.** Open the release page (or
|
||
|
|
`GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>`) and require a
|
||
|
|
non-zero `size` for every asset: the two Linux binaries + `.sha256`, the
|
||
|
|
APK + `.sha256`, the AAR + `.sha256`. A green run is not proof — the Pi
|
||
|
|
runner hairpins through Cloudflare and has uploaded 0-byte assets before.
|
||
|
|
|
||
|
|
## Inputs
|
||
|
|
|
||
|
|
| Input | Default | Meaning |
|
||
|
|
|---|---|---|
|
||
|
|
| `dry_run` | `false` | Build + checksum only. No tag, no publish. |
|
||
|
|
| `bump` | `minor` | `patch` / `minor` / `major` off the newest `v*.*.*` tag. |
|
||
|
|
| `version` | — | Explicit `X.Y.Z` or `vX.Y.Z`; overrides `bump`. |
|
||
|
|
| `tag` | — | Rebuild / re-publish an existing tag instead of minting a new one. |
|
||
|
|
|
||
|
|
Contradictory input is rejected, never guessed at:
|
||
|
|
|
||
|
|
- `tag` **and** `version` together → the run fails in the `version` job.
|
||
|
|
- `version` that is not `MAJOR.MINOR.PATCH` (optionally `v`-prefixed) → fails.
|
||
|
|
- `bump` outside `patch|minor|major` → fails.
|
||
|
|
|
||
|
|
## What the run does
|
||
|
|
|
||
|
|
`version` job (Pi runner):
|
||
|
|
|
||
|
|
1. Resolves the tag: the `tag` input, else the `version` input, else `bump`
|
||
|
|
applied to the newest `v*.*.*` tag (`v0.1.0` when the repo has no tags).
|
||
|
|
2. When minting a new version, creates the tag over the Forgejo API. If the
|
||
|
|
tag already exists on a different commit, the run **refuses to move it**
|
||
|
|
and fails. `201` means created; `409` means it was created concurrently and
|
||
|
|
this run joins it.
|
||
|
|
|
||
|
|
`aarch64` (Pi runner) and `x86_64` (amd64 runner) jobs build the binary in a
|
||
|
|
`rust:*-bookworm` container, strip it, refuse an empty binary, write the
|
||
|
|
`.sha256`, and upload it as an artifact.
|
||
|
|
|
||
|
|
`publish` job (Pi runner) downloads both artifacts, refuses any empty file,
|
||
|
|
and calls `scripts/publish-release.sh` to create-or-update the release with all
|
||
|
|
four Linux assets. If this job fails and the tag was created by *this* run, the
|
||
|
|
final step deletes the incomplete release and the tag. A failed `aarch64` or
|
||
|
|
`x86_64` job always fails `publish`, so nothing is published half-built.
|
||
|
|
|
||
|
|
## Android (APK + AAR) on the same tag
|
||
|
|
|
||
|
|
Creating the tag sends the same push notification a `git push` would, and
|
||
|
|
[`android-release.yml`](../.forgejo/workflows/android-release.yml) is
|
||
|
|
subscribed to `push: tags: v*.*.*`. The core workflow therefore does not call
|
||
|
|
it, and no `main`-push trigger exists on either file.
|
||
|
|
|
||
|
|
That run builds the signed APK and the SDK AAR on the **amd64** runner (the Pi
|
||
|
|
is aarch64 and cannot produce an APK), then a second job on the Pi attaches the
|
||
|
|
APK + AAR + `.sha256` to the same tag. If the release does not exist yet it is
|
||
|
|
created; if it exists it is joined (`publish-release.sh` is create-or-update).
|
||
|
|
Android assets land on the release a while after the Linux ones — the Android
|
||
|
|
build is the long pole.
|
||
|
|
|
||
|
|
The workflow also has `workflow_dispatch` with the same `tag` / `dry_run`
|
||
|
|
inputs, which is how you repair or re-attach the Android assets by hand.
|
||
|
|
|
||
|
|
## Rebuilding an existing tag
|
||
|
|
|
||
|
|
- **Both** Linux binaries: dispatch `release` with `tag=vX.Y.Z`. The tag's own
|
||
|
|
commit is built, its existing assets are replaced, and no new tag is created.
|
||
|
|
- **Android only**: dispatch `android-release` with `tag=vX.Y.Z`.
|
||
|
|
- The local `FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z`
|
||
|
|
fallback does the x86_64 build without CI.
|
||
|
|
|
||
|
|
Never move or delete a published `v*.*.*` tag by hand, and never create one by
|
||
|
|
hand: a hand-pushed tag starts nothing (`release.yml` has no tag-push trigger),
|
||
|
|
and `release.yml` will refuse to move a tag that exists on another commit.
|
||
|
|
|
||
|
|
## Version policy
|
||
|
|
|
||
|
|
`MAJOR.MINOR.PATCH` on the tag (`v`-prefixed). The default bump is `minor`: a
|
||
|
|
batched release is usually a feature set, and `patch`-incrementing it would
|
||
|
|
mislabel it. Use `patch` for a fix-only batch, `major` for a breaking wire or
|
||
|
|
store change. The tag is the version users see; `Cargo.toml` is **not** edited
|
||
|
|
by the workflow — keep it in sync by hand if the crate version matters to you.
|
||
|
|
The Android `versionCode` is derived by the Android workflow from
|
||
|
|
`major*10000 + minor*100 + patch`.
|
||
|
|
|
||
|
|
## What the workflows do not gate on
|
||
|
|
|
||
|
|
- **No "CI must be green" check inside the release job.** The operator checks
|
||
|
|
that by hand before dispatching. A release dispatched while CI is red will
|
||
|
|
build and publish anyway.
|
||
|
|
- No changelog generation: `scripts/release-body.md` is the template, with
|
||
|
|
`@TAG@` substituted.
|
||
|
|
- No approval gate, no environment protection, no automatic rollback beyond
|
||
|
|
the fail-closed tag delete described above.
|
||
|
|
- No notification on success: read the run and the release page.
|