ci(release): android-release cannot be woken by a CI-created tag — make it dispatch-only #63

Merged
sirius merged 3 commits from wt/t_95e0d607 into main 2026-09-12 23:11:25 +00:00
4 changed files with 58 additions and 31 deletions

View file

@ -15,16 +15,20 @@ name: android-release
# latest v*.*.* tag UNLESS that tag's release is missing the Android assets — # 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. # 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 # No automatic trigger, on purpose. Two candidate decoupled triggers were
# APK. This workflow is woken by the tag release.yml creates for a manual, # tried and both dead-end on Forgejo 10.0.3 (see docs/RELEASING.md):
# batched release — creating a tag over the API sends the same push # - `push: tags: ['v*.*.*']` — a tag created by release.yml (API or git push)
# notification a `git push` does, so the tag ref matches this filter. # does not fire it: pushes made with the CI's token are Actions-user events
# See docs/RELEASING.md. # and Forgejo deliberately does not dispatch those back into Actions.
# Verified: the v0.2.0 and v0.2.1 tags produced no run, while hand-pushed
# tags did historically.
# - `workflow_call` from release.yml — reusable workflows only exist from
# Forgejo 12; this instance is 10.0.3.
# So a release is two dispatches: release.yml, then this one with `tag=<the
# tag the core just created>`. The core's run leaves the tag; this attaches
# the APK + AAR to it.
on: on:
push:
tags:
- "v*.*.*"
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: tag:

View file

@ -4,9 +4,10 @@ name: release
# PR does not mint a release. A maintainer dispatches this at a stopping point # 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. # (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 # 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 # via the API, and a tag-push hook would start a second run of the same release.
# release. Creating the tag *does* fire android-release.yml's `push: tags` # (A tag this workflow creates does not wake android-release.yml either — see
# trigger, which is how the APK + AAR join the same release. # docs/RELEASING.md: on this Forgejo, pushes made with the CI token are
# Actions-user events and are not dispatched back into Actions.)
# Version: explicit `version`, else `bump` off the newest v*.*.* tag # 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. # (default minor — a batched release is usually a feature set); zero tags → v0.1.0.
on: on:

View file

@ -269,7 +269,10 @@ rationale, the 16 KB page-size check and the signing story are in
Releases are **manual and batched**: no merge publishes anything, and neither 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 — 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 CI green on `main`, the feature set landed, no half-merged stack. Full policy
and procedure: [`docs/RELEASING.md`](docs/RELEASING.md). and procedure: [`docs/RELEASING.md`](docs/RELEASING.md) — it is two dispatches,
`release` (tag + Linux binaries) then `android-release` with that tag (APK +
AAR): on this Forgejo neither a tag push nor `workflow_call` can wake the
Android job.
Actions → release → Run workflow: Actions → release → Run workflow:
@ -284,9 +287,10 @@ Pass `tag` **or** `version`, not both; an unparseable version is rejected
rather than guessed at. The workflow computes the version, creates the tag over 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 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>` x86_64 on the amd64 runner, and publishes all four assets (`onionwire-<target>`
+ `.sha256`) to one release. Creating that tag fires `android-release.yml`, + `.sha256`) to one release. Then dispatch `android-release` with that tag to
which builds the APK + AAR and joins the same release. If a build or the attach the APK + AAR to the same release (it has no automatic trigger on this
publish fails, the run deletes the tag it created. Do not push tags by hand — Forgejo — see `docs/RELEASING.md`). If a build or the publish fails, the core
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 `release.yml` has no tag-push trigger, so a hand-pushed tag would build
nothing. nothing.
@ -301,7 +305,7 @@ FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
Workflows (Forgejo Actions, `.forgejo/workflows/`): 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/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) — 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`. - [`.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. Dispatch [`android-release.yml`](.forgejo/workflows/android-release.yml) with that tag to add the APK + AAR (no automatic trigger fires on this Forgejo; it is `workflow_dispatch` only). 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: Scripts:

View file

@ -37,7 +37,10 @@ created if the build or publish fails", and the dry-run path.
4. **Watch it.** The run name is `release`; `scripts/watch-release-run.sh` 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 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). database, so it works for dispatched runs as well as any other).
5. **Check the assets.** Open the release page (or 5. **Attach the Android assets.** Dispatch `android-release` with the tag the
core run just created — see [Android](#android-apk--aar-on-the-same-tag).
The Linux binaries land first; the APK build is the long pole.
6. **Check the assets.** Open the release page (or
`GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>`) and require a `GET /api/v1/repos/sirius/onionwire/releases/tags/<tag>`) and require a
non-zero `size` for every asset: the two Linux binaries + `.sha256`, the 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 APK + `.sha256`, the AAR + `.sha256`. A green run is not proof — the Pi
@ -81,20 +84,35 @@ final step deletes the incomplete release and the tag. A failed `aarch64` or
## Android (APK + AAR) on the same tag ## Android (APK + AAR) on the same tag
Creating the tag sends the same push notification a `git push` would, and A release is **two dispatches**. After the core run has created the tag and
[`android-release.yml`](../.forgejo/workflows/android-release.yml) is published the Linux binaries:
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 1. Actions → **android-release** → *Run workflow*, `tag=vX.Y.Z` (the tag the
is aarch64 and cannot produce an APK), then a second job on the Pi attaches the core just created; leave `dry_run` false).
APK + AAR + `.sha256` to the same tag. If the release does not exist yet it is 2. Check the release again — the APK + AAR + `.sha256` are attached to the
created; if it exists it is joined (`publish-release.sh` is create-or-update). **same** tag. If the release did not exist yet it is created; if it exists
Android assets land on the release a while after the Linux ones — the Android it is joined (`publish-release.sh` is create-or-update).
build is the long pole.
The workflow also has `workflow_dispatch` with the same `tag` / `dry_run` `android-release.yml` has no automatic trigger, and that is deliberate. Both
inputs, which is how you repair or re-attach the Android assets by hand. candidate decoupled triggers were tried on this instance and neither fires:
- **A tag created by `release.yml` does not wake `push: tags: ['v*.*.*']`.**
Tried both ways — the tag created through `POST /tags`, and the tag created
by a real `git push` from the version job. Neither produced an
`android-release` run: 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 that `IsActions()` is ignored).
Historically, *hand-pushed* tags did fire tag-filtered workflows, which is why
the trigger looked plausible.
- **`workflow_call` is unavailable.** Reusable workflows only appear in the
Forgejo docs from v12 onward; this instance reports
`10.0.3+gitea-1.22.0` (`GET /api/v1/version`), so a caller job with
`uses: ./.forgejo/workflows/android-release.yml` would never run. The
`workflow_call` block 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.
## Rebuilding an existing tag ## Rebuilding an existing tag