"The source is public" is not a check anyone can run, and against a Tor + Monero tool the surviving objection is that the released binary might not be that source. This makes the build checkable instead of trusted. - scripts/reproducible-build.sh is the single definition of a release build: digest-pinned builder image, fixed in-container paths, SOURCE_DATE_EPOCH from the released commit, --locked, its own apt build deps, and RUSTFLAGS replaced rather than extended. The fixed paths are load-bearing: rustc's --remap-path-prefix cannot reach absolute paths compiled in by a C toolchain, and this graph always has one (rusqlite compiles OpenSSL from vendored sources; the default cuprate-daemon adds RandomX and cmake). It also records toolchain versions in build-info, because the apt build deps are not digest-pinned the way the image is. - release.yml pins the image by digest, resolves SOURCE_DATE_EPOCH from the tag's commit, runs that recipe, and uploads build-info-<target>.txt beside the binary. The cargo target volume is created per run and removed, so the published artifact cannot come out of a cache that a verifier does not have. - scripts/verify-reproducible.sh rebuilds a tag in the same pinned image and compares bytes against the release asset. Two fresh builds of the same tree in that image produce identical sha256. - scripts/sign-release.sh signs with minisign and verifies its own signature against the committed public key. The publish job signs BEFORE publishing and fails closed without MINISIGN_SECRET_KEY, so nothing unsigned reaches the release page: an unsigned release is indistinguishable from a signed one to anyone who is not checking. Checked: signature accepted by an independent minisign -V, a tampered file rejected, a missing key refused, a missing public key refused. - build-release-local.sh runs the same container and the same recipe. A host cargo build would publish a hash nobody could reproduce, which is worse than having no fallback at all. - docs/VERIFY.md is the verifier-facing walkthrough: the dependency graph and where its HTTP actually comes from, the wallet's real seed-read exposure, the rebuild check, the signature check, and an explicit list of what none of it proves. - Cargo.toml repository: point at the Forgejo instance that hosts this and builds its releases. Needs a MINISIGN_SECRET_KEY secret before the next release; without it the publish job stops by design. docs/RELEASING.md has the keygen procedure.
14 KiB
Releasing OnionWire
How a maintainer cuts a release. This is not automatic: a merge to main
does not publish, and a tag push does not publish. Two dispatches, dry_run
first, Android APK joins the same tag.
Short version: README.md.
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(theciworkflow 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
-
Confirm the stopping point.
mainis 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 whatevermain's head is when the tag is created. -
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 wakesandroid-release.) -
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. -
Watch it. The run name is
release;scripts/watch-release-run.shreports job status (it readsaction_run/action_run_jobon the Pi's database, so it works for dispatched runs as well as any other). -
Attach the Android assets. Dispatch
android-releasewith the tag the core run just created — see Android. The Linux binaries land first; the APK build is the long pole. -
Check the assets. Open the release page (or
GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>) and require a non-zerosizefor every asset. A Linux release is eleven assets:asset what it is onionwire-<target>×2the two Linux binaries onionwire-<target>.sha256×2their checksums onionwire-<target>.minisig×2the binary signatures onionwire-<target>.sha256.minisig×2the checksum signatures build-info-<target>.txt×2the recipe record (commit, epoch, toolchain, image digest) onionwire-signing.pubthe public half of the signing key plus the APK +
.sha256and the AAR +.sha256attached byandroid-release. A green run is not proof — the Pi runner hairpins through Cloudflare and has uploaded 0-byte assets before. -
Spot-check reproducibility. On any machine with docker and a clone:
scripts/verify-reproducible.sh <tag>It has to print
RESULT: MATCH. AMISMATCHmeans the published binary is not what this tag builds to — release-blocking, not cosmetic. Diagnose with thebuild-info-<target>.txton the release before assuming compromise: a different commit or a moved image digest explains most mismatches.
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:
tagandversiontogether → the run fails in theversionjob.versionthat is notMAJOR.MINOR.PATCH(optionallyv-prefixed) → fails.bumpoutsidepatch|minor|major→ fails.
What the run does
version job (Pi runner):
- Resolves the tag: the
taginput, else theversioninput, elsebumpapplied to the newestv*.*.*tag (v0.1.0when the repo has no tags). - 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.
201means created;409means it was created concurrently and this run joins it.
aarch64 (Pi runner) and x86_64 (amd64 runner) jobs run
scripts/reproducible-build.sh inside the digest-pinned builder image
(RUST_IMAGE in the workflow). That script owns the whole build: --locked,
fixed in-container paths, SOURCE_DATE_EPOCH from the released commit, the
--remap-path-prefix set, strip --strip-all, the .sha256, and the
build-info-<target>.txt record. The job then only refuses a half-made dist and
uploads it — the target volume is created per run and removed afterwards, so the
published binary cannot come out of a cache a verifier does not have.
The SOURCE_DATE_EPOCH step reads the committer time of
needs.version.outputs.sha. It is deliberately not "now": a rebuild of this tag
in six months has to hand the compiler the same epoch CI handed it.
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
A release is two dispatches. After the core run has created the tag and published the Linux binaries:
- Actions → android-release → Run workflow,
tag=vX.Y.Z(the tag the core just created; leavedry_runfalse). - Check the release again — the APK + AAR +
.sha256are attached to the same tag. If the release did not exist yet it is created; if it exists it is joined (publish-release.shis create-or-update).
android-release.yml has no automatic trigger, and that is deliberate. Both
candidate decoupled triggers were tried on this instance and neither fires:
- A tag created by
release.ymldoes not wakepush: tags: ['v*.*.*']. Tried both ways — the tag created throughPOST /tags, and the tag created by a realgit pushfrom the version job. Neither produced anandroid-releaserun: pushes made with the CI's token are Actions-user events, and Forgejo deliberately does not dispatch those back into Actions (services/actions/notifier_helper.go: a doer thatIsActions()is ignored). Historically, hand-pushed tags did fire tag-filtered workflows, which is why the trigger looked plausible. workflow_callis unavailable. Reusable workflows only appear in the Forgejo docs from v12 onward; this instance reports10.0.3+gitea-1.22.0(GET /api/v1/version), so a caller job withuses: ./.forgejo/workflows/android-release.ymlwould never run. Theworkflow_callblock is left declared for the day the instance is upgraded.
The Android build runs on the amd64 runner (the Pi is aarch64 and cannot produce an APK), then a second job on the Pi attaches the assets. It is the long pole of a release — the Linux binaries land first.
Android CI (not a release)
android-ci.yml runs the same gradle targets on the same amd64 runner, so an
android-only PR is no longer merged on an empty check list. It signs with the
debug key (ONIONWIRE_REQUIRE_RELEASE_KEY=false, no keystore) and
publishes nothing — apksigner in that job reports the debug cert, which is
expected there and never in android-release. It shares
android-release.yml's concurrency group and volumes, so the PR build is warm
(~9 min) instead of re-downloading a gigabyte of SDK/NDK.
The two triggers are deliberately not the same, because the APK embeds the
root crate as libonionwire_sdk.so and a full build costs ~11 minutes:
pull_request—android/**,crates/onionwire-sdk/**,Cargo.toml,Cargo.lock,scripts/build-android-local.sh. Client and binding-surface changes get the pre-merge signal.push: [main]— the above plussrc/**andcrates/**. Every merge of a Rust change still runs the full build, including the in-APK checks that earn their keep (thetarget_max_memorymarker gate, the.solisting, the sha256 round-trip). Nothing reaches a release untested; a Rust-only PR finds out at merge rather than before it.
Both ci.yml and android-ci.yml open with a staleness gate: they compare
GITHUB_SHA against the remote branch tip and skip the build if a newer commit
landed while the run sat in the concurrency queue. cancel-in-progress is
deliberately false on both (cancelling a queued run would let two cargo jobs
share the Pi's target volume, which produces Permission denied (os error 13)
on /target/debug/deps), so the gate is what removes superseded work. A
git ls-remote failure runs the job rather than skipping it.
The ci / fuzz job is not in ci.yml any more — it is
.forgejo/workflows/fuzz.yml, schedule-only at 03:30 UTC plus
workflow_dispatch. A job cannot narrow a workflow-level path filter, so
fuzz/** sat beside src/** in ci.yml's list and the job ran on nearly
every push (80 of 84 recorded runs touched nothing in fuzz/), each paying a
nightly toolchain install and cargo install cargo-fuzz for 15 seconds of
fuzzing. Fuzz output is not attached to any PR; check the fuzz workflow's
run history for it.
Rebuilding an existing tag
- Both Linux binaries: dispatch
releasewithtag=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-releasewithtag=vX.Y.Z. - The local
FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Zfallback 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.
Reproducibility and signing
Two properties a download can be checked against, and one prerequisite that no one else can do for you.
The recipe
scripts/reproducible-build.sh is the single definition of a release build.
Everything that can move the output bytes is pinned inside it:
- the builder image, by digest.
rust:1.98-bookwormfloats, and a rustc patch release changes codegen. The digest must be identical in three files —RUST_IMAGEin.forgejo/workflows/release.yml, andBUILDER_IMAGEin bothscripts/verify-reproducible.shandscripts/build-release-local.sh. Bump all three in one commit, and expect the hashes to change: that is a toolchain change, not a compromise. - fixed absolute paths, because rustc's
--remap-path-prefixcannot reach absolute paths compiled in by a C toolchain, and this crate always has one:rusqlite'sbundled-sqlcipher-vendored-opensslcompiles OpenSSL from source and OpenSSL bakes its build paths into the artifact. SOURCE_DATE_EPOCHfrom the released commit's committer date.--locked, andRUSTFLAGSis replaced rather than extended so an ambient profile setting cannot silently change the bytes.
The signing key (one-time, yours to hold)
minisign -G -W -p scripts/onionwire-signing.pub -s onionwire-signing.key
-W keeps the secret key unencrypted, because CI cannot answer a prompt and a
passphrase stored beside the key protects nothing. Then commit the .pub, add
the .key file's contents as the Actions secret MINISIGN_SECRET_KEY, and
delete the .key from your machine.
Until that secret exists, releases fail. The signing step runs before publish and exits non-zero without a key, so nothing unsigned reaches the release page. That is deliberate: an unsigned release is indistinguishable from a signed one to anyone who is not checking, which makes it worse than no release.
scripts/sign-release.sh also verifies each signature it just made against the
committed public key before returning, so a broken key fails at signing rather
than after the assets are public.
The local fallback
scripts/build-release-local.sh runs the same pinned container and the same
recipe, and requires MINISIGN_SECRET_KEY too. It is a fallback for a dead
runner, not a way to ship something the verifier cannot reproduce — a host
cargo build would produce a binary whose hash no one could match.
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.mdis 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.