ci(release): manual, batched releases — no release on merge
All checks were successful
ci / test (pull_request) Successful in 3m49s
All checks were successful
ci / test (pull_request) Successful in 3m49s
Drop `push: branches: [main]` from both release workflows. release.yml now runs only via workflow_dispatch, with bump (default minor), version, tag and dry_run inputs; contradictory input is rejected instead of guessed at. android-release.yml keeps the Android assets on the same tag by subscribing to `push: tags: v*.*.*`: creating a tag over the API sends the same push notification a git push does, so the core's tag wakes it. No workflow_call — this Forgejo is 10.0.3, where reusable workflows are not supported. docs/RELEASING.md is the policy and procedure.
This commit is contained in:
parent
acb6c7dd65
commit
6c9fd00b8a
5 changed files with 225 additions and 38 deletions
|
|
@ -14,19 +14,17 @@ name: android-release
|
|||
# First automated version with zero tags: v0.1.0. Afterwards, patch+1 from the
|
||||
# latest v*.*.* tag UNLESS that tag's release is missing the Android assets —
|
||||
# then join it (core owns tag creation). Never move or delete a tag.
|
||||
#
|
||||
# No `push: branches: [main]` trigger: a merged android PR does not publish an
|
||||
# APK. This workflow is woken by the tag release.yml creates for a manual,
|
||||
# batched release — creating a tag over the API sends the same push
|
||||
# notification a `git push` does, so the tag ref matches this filter.
|
||||
# See docs/RELEASING.md.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "android/app/**"
|
||||
- "android/sdk/**"
|
||||
- "android/*.gradle.kts"
|
||||
- "android/gradle/**"
|
||||
- "android/gradle.properties"
|
||||
- "android/settings.gradle.kts"
|
||||
- "scripts/build-android-local.sh"
|
||||
- ".forgejo/workflows/android-release.yml"
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
|
|
|
|||
|
|
@ -1,23 +1,32 @@
|
|||
name: release
|
||||
|
||||
# Auto-tag and publish both Linux binaries when core paths land on main.
|
||||
# Tag-push is intentionally NOT a trigger: this workflow creates the tag via
|
||||
# the API, and a tag-push hook would start a second run of the same release.
|
||||
# Rebuild an existing tag (or dry-run a build) with workflow_dispatch.
|
||||
# Version: latest v*.*.* tag → patch+1; zero tags → v0.1.0.
|
||||
# Manual, batched releases. There is deliberately NO push trigger: a merged
|
||||
# PR does not mint a release. A maintainer dispatches this at a stopping point
|
||||
# (a batch of work has landed and CI is green on main) — see docs/RELEASING.md.
|
||||
# Tag-push is intentionally NOT a trigger here: this workflow creates the tag
|
||||
# via the API, and a tag-push hook would start a second run of the same
|
||||
# release. Creating the tag *does* fire android-release.yml's `push: tags`
|
||||
# trigger, which is how the APK + AAR join the same release.
|
||||
# Version: explicit `version`, else `bump` off the newest v*.*.* tag
|
||||
# (default minor — a batched release is usually a feature set); zero tags → v0.1.0.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "crates/**"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- "scripts/release-body.md"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
bump:
|
||||
description: Bump off the newest v*.*.* tag (ignored when version or tag is set)
|
||||
required: false
|
||||
type: choice
|
||||
options:
|
||||
- minor
|
||||
- patch
|
||||
- major
|
||||
default: minor
|
||||
version:
|
||||
description: Explicit version MAJOR.MINOR.PATCH (or vMAJOR.MINOR.PATCH); overrides bump
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
description: Existing tag to (re)build and publish (empty = next version)
|
||||
description: Existing tag to (re)build and publish (empty = create the next version)
|
||||
required: false
|
||||
type: string
|
||||
dry_run:
|
||||
|
|
@ -57,6 +66,8 @@ jobs:
|
|||
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
EVENT_SHA: ${{ github.sha }}
|
||||
INPUT_BUMP: ${{ github.event.inputs.bump }}
|
||||
INPUT_VERSION: ${{ github.event.inputs.version }}
|
||||
INPUT_TAG: ${{ github.event.inputs.tag }}
|
||||
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
|
||||
run: |
|
||||
|
|
@ -69,7 +80,7 @@ jobs:
|
|||
true|True|TRUE|1|yes|YES) dry_run=true ;;
|
||||
esac
|
||||
fi
|
||||
echo "event=$EVENT_NAME sha=$EVENT_SHA input_tag=${INPUT_TAG-} input_dry_run=${INPUT_DRY_RUN-} dry_run=$dry_run"
|
||||
echo "event=$EVENT_NAME sha=$EVENT_SHA input_version=${INPUT_VERSION-} input_tag=${INPUT_TAG-} input_bump=${INPUT_BUMP-} input_dry_run=${INPUT_DRY_RUN-} dry_run=$dry_run"
|
||||
|
||||
api_curl() {
|
||||
curl -sS --http1.1 --retry 5 --retry-all-errors --retry-delay 3 \
|
||||
|
|
@ -78,6 +89,13 @@ jobs:
|
|||
}
|
||||
|
||||
input_tag="${INPUT_TAG:-}"
|
||||
version_input="${INPUT_VERSION:-}"
|
||||
bump="${INPUT_BUMP:-minor}"
|
||||
# Contradictory input is rejected, never guessed at.
|
||||
if [ -n "$input_tag" ] && [ -n "$version_input" ]; then
|
||||
echo "got both tag='$input_tag' and version='$version_input': tag rebuilds an existing tag, version mints a new one — pass one" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$input_tag" ]; then
|
||||
code=$(api_curl -o /tmp/tag.json -w '%{http_code}' \
|
||||
"$REPO_API/tags/$input_tag")
|
||||
|
|
@ -91,8 +109,33 @@ jobs:
|
|||
created=false
|
||||
echo "re-publish existing tag $tag at $sha (dry_run=$dry_run)"
|
||||
else
|
||||
api_curl "$REPO_API/tags?limit=50" -o /tmp/tags.json
|
||||
tag=$(python3 -c "import json,re; tags=json.load(open('/tmp/tags.json')); assert isinstance(tags, list), tags; semver=[]; [semver.append((int(m[1]), int(m[2]), int(m[3]))) for t in tags for m in [re.fullmatch(r'v([0-9]+)\.([0-9]+)\.([0-9]+)', t.get('name') or '')] if m]; print('v0.1.0' if not semver else 'v%d.%d.%d' % (max(semver)[0], max(semver)[1], max(semver)[2] + 1))")
|
||||
if [ -n "$version_input" ]; then
|
||||
tag=$(python3 -c "import re,sys; m=re.fullmatch(r'v?([0-9]+)\.([0-9]+)\.([0-9]+)', sys.argv[1].strip()); print('v' + '.'.join(m.groups()) if m else '')" "$version_input")
|
||||
if [ -z "$tag" ]; then
|
||||
echo "version must be MAJOR.MINOR.PATCH or vMAJOR.MINOR.PATCH, got '$version_input'" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
case "$bump" in
|
||||
patch|minor|major) ;;
|
||||
*) echo "bump must be patch|minor|major, got '$bump'" >&2; exit 1 ;;
|
||||
esac
|
||||
api_curl "$REPO_API/tags?limit=50" -o /tmp/tags.json
|
||||
latest=$(python3 -c "import json,re; tags=json.load(open('/tmp/tags.json')); assert isinstance(tags, list), tags; s=[tuple(int(x) for x in m.groups()) for t in tags for m in [re.fullmatch(r'v([0-9]+)\.([0-9]+)\.([0-9]+)', t.get('name') or '')] if m]; print('%d.%d.%d' % max(s) if s else '')")
|
||||
if [ -z "$latest" ]; then
|
||||
tag="v0.1.0"
|
||||
else
|
||||
major="${latest%%.*}"
|
||||
rest="${latest#*.}"
|
||||
minor="${rest%%.*}"
|
||||
patch="${rest#*.}"
|
||||
case "$bump" in
|
||||
major) tag="v$((major + 1)).0.0" ;;
|
||||
minor) tag="v$major.$((minor + 1)).0" ;;
|
||||
patch) tag="v$major.$minor.$((patch + 1))" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
sha="$EVENT_SHA"
|
||||
created=false
|
||||
if [ "$dry_run" = "true" ]; then
|
||||
|
|
|
|||
36
README.md
36
README.md
|
|
@ -25,7 +25,7 @@ Arti onion services are still **experimental**. If the hidden service cannot com
|
|||
|
||||
### Option A — download a release binary
|
||||
|
||||
CI (`.forgejo/workflows/release.yml`) tags and publishes both Linux binaries on every `main` push that touches the core (`src/`, `crates/`, `Cargo.toml`, `Cargo.lock`, or `scripts/release-body.md`). Workflow-only edits do not mint a release — validate those with Actions → release → `dry_run=true`. aarch64 builds on the Pi runner; x86_64 builds on the amd64 runner. Both attach to the same [Forgejo release](https://forgejo.siriusdevops.com/sirius/onionwire/releases). `scripts/build-release-local.sh` remains the offline x86_64 fallback. This Forgejo does not serve `/releases/latest/download/…` (404); pin the tag.
|
||||
CI (`.forgejo/workflows/release.yml`) does **not** release on a merge. Releases are manual and batched: a maintainer runs the workflow at a stopping point (Actions → release → Run workflow, `dry_run=true` first), which tags the next `v*.*.*` version and publishes both Linux binaries — aarch64 on the Pi runner, x86_64 on the amd64 runner — to one [Forgejo release](https://forgejo.siriusdevops.com/sirius/onionwire/releases), with the Android APK + AAR attached to that same tag. Policy and inputs: [docs/RELEASING.md](docs/RELEASING.md). `scripts/build-release-local.sh` remains the offline x86_64 fallback. This Forgejo does not serve `/releases/latest/download/…` (404); pin the tag.
|
||||
|
||||
**x86_64 (most PCs / VMs):**
|
||||
|
||||
|
|
@ -269,20 +269,34 @@ rationale, the 16 KB page-size check and the signing story are in
|
|||
|
||||
## Releases (maintainers)
|
||||
|
||||
A core change on `main` is enough. The release workflow computes the next
|
||||
`v*.*.*` tag (patch+1, or `v0.1.0` if there are no tags), creates it via the
|
||||
API, builds aarch64 on the Pi runner and x86_64 on the amd64 runner, and
|
||||
publishes all four assets (`onionwire-<target>` + `.sha256`) to one release.
|
||||
Do not push tags by hand — a tag-push trigger would start a second run.
|
||||
Releases are **manual and batched**: no merge publishes anything, and neither
|
||||
does a tag push. Cut one when a batch of work has reached a stopping point —
|
||||
CI green on `main`, the feature set landed, no half-merged stack. Full policy
|
||||
and procedure: [`docs/RELEASING.md`](docs/RELEASING.md).
|
||||
|
||||
Actions → release → Run workflow:
|
||||
|
||||
| Input | Meaning |
|
||||
|---|---|
|
||||
| `dry_run` | build + checksum both Linux binaries, no tag, no publish. Run this first. |
|
||||
| `bump` | `patch` / `minor` / `major` off the newest `v*.*.*` tag. Default `minor`. |
|
||||
| `version` | explicit `X.Y.Z` (or `vX.Y.Z`) — overrides `bump`. |
|
||||
| `tag` | rebuild / re-publish an existing tag instead of minting one. |
|
||||
|
||||
Pass `tag` **or** `version`, not both; an unparseable version is rejected
|
||||
rather than guessed at. The workflow computes the version, creates the tag over
|
||||
the API (refusing to move an existing tag), builds aarch64 on the Pi runner and
|
||||
x86_64 on the amd64 runner, and publishes all four assets (`onionwire-<target>`
|
||||
+ `.sha256`) to one release. Creating that tag fires `android-release.yml`,
|
||||
which builds the APK + AAR and joins the same release. If a build or the
|
||||
publish fails, the run deletes the tag it created. Do not push tags by hand —
|
||||
`release.yml` has no tag-push trigger, so a hand-pushed tag would build
|
||||
nothing.
|
||||
|
||||
```bash
|
||||
# optional: keep Cargo.toml in sync with the tag the workflow will mint
|
||||
# (the workflow does not edit Cargo.toml)
|
||||
|
||||
# rebuild / re-publish an existing tag, or dry-run a build with no tag:
|
||||
# Actions → release → Run workflow → tag=vX.Y.Z and/or dry_run=true
|
||||
# (dry_run is how you test release.yml without cutting a user-facing release)
|
||||
|
||||
# offline x86_64 fallback (idempotent — safe to re-run)
|
||||
FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
|
||||
```
|
||||
|
|
@ -290,7 +304,7 @@ FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
|
|||
Workflows (Forgejo Actions, `.forgejo/workflows/`):
|
||||
|
||||
- [`.forgejo/workflows/ci.yml`](.forgejo/workflows/ci.yml) — `cargo test --locked` + `cargo clippy --all-targets -- -D warnings` on `main` and PRs when `src/`, `crates/`, `tests/`, `Cargo.toml`, `Cargo.lock`, or this workflow change (ignored Tor-live tests are not run). `workflow_dispatch` always runs the suite. Pi runner, `docker` label.
|
||||
- [`.forgejo/workflows/release.yml`](.forgejo/workflows/release.yml) — on core paths to `main` (`src/`, `crates/`, `Cargo.toml`, `Cargo.lock`, `scripts/release-body.md`): next tag, aarch64 (`docker`) + x86_64 (`docker-amd64`), one release. `workflow_dispatch` rebuilds a tag or `dry_run`s. Concurrency group `onionwire-ci-pi` (same as `ci.yml`, `cancel-in-progress: false`) so cargo jobs do not overlap on the Pi. Amd64 dind is serialized by runner `capacity=1`.
|
||||
- [`.forgejo/workflows/release.yml`](.forgejo/workflows/release.yml) — manual, batched release (`workflow_dispatch` only: `dry_run`, `bump`, `version`, `tag`): next tag, aarch64 (`docker`) + x86_64 (`docker-amd64`), one release, fail-closed tag delete on failure. The tag it creates fires [`android-release.yml`](.forgejo/workflows/android-release.yml) (`push: tags: v*.*.*`), which joins the same release with the APK + AAR. Concurrency group `onionwire-ci-pi` (same as `ci.yml`, `cancel-in-progress: false`) so cargo jobs do not overlap on the Pi. Amd64 dind is serialized by runner `capacity=1`.
|
||||
|
||||
Scripts:
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,5 @@ Read these in order if you are evaluating the protocol without the Rust:
|
|||
Operator / product docs stay in the [root README](../README.md). Android
|
||||
build notes: [android/README.md](../android/README.md). SDK:
|
||||
[crates/onionwire-sdk/README.md](../crates/onionwire-sdk/README.md).
|
||||
Maintainers cutting a release: [RELEASING.md](RELEASING.md) — manual, batched
|
||||
releases, not one per merge.
|
||||
|
|
|
|||
130
docs/RELEASING.md
Normal file
130
docs/RELEASING.md
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
# 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.
|
||||
Loading…
Reference in a new issue