ci(release): android-release cannot be woken by a CI-created tag — make it dispatch-only #63
4 changed files with 73 additions and 50 deletions
ci(release): android-release is dispatch-only; a CI-created tag cannot wake it
Neither decoupled trigger fires on Forgejo 10.0.3: a tag created by the CI (API or git push) is an Actions-user push and is not dispatched back into Actions, and reusable workflows need Forgejo >= 12. The release procedure is therefore two dispatches: release.yml, then android-release with that tag.
commit
2cf055c1e8
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -4,10 +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
|
||||||
# itself and a tag-push hook would start a second run of the same release.
|
# via the API, and a tag-push hook would start a second run of the same release.
|
||||||
# The tag is created with a real `git push` (not POST /tags) precisely so that
|
# (A tag this workflow creates does not wake android-release.yml either — see
|
||||||
# android-release.yml's `push: tags` trigger fires and the APK + AAR join the
|
# docs/RELEASING.md: on this Forgejo, pushes made with the CI token are
|
||||||
# same release — an API-created tag sends no push event on this Forgejo.
|
# 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:
|
||||||
|
|
@ -60,15 +60,11 @@ jobs:
|
||||||
dry_run: ${{ steps.plan.outputs.dry_run }}
|
dry_run: ${{ steps.plan.outputs.dry_run }}
|
||||||
created_tag: ${{ steps.plan.outputs.created_tag }}
|
created_tag: ${{ steps.plan.outputs.created_tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source (needed to create the tag)
|
|
||||||
uses: https://code.forgejo.org/actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Plan version, create tag unless dry_run
|
- name: Plan version, create tag unless dry_run
|
||||||
id: plan
|
id: plan
|
||||||
env:
|
env:
|
||||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||||
GIT_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
|
||||||
EVENT_NAME: ${{ github.event_name }}
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
EVENT_SHA: ${{ github.sha }}
|
EVENT_SHA: ${{ github.sha }}
|
||||||
INPUT_BUMP: ${{ github.event.inputs.bump }}
|
INPUT_BUMP: ${{ github.event.inputs.bump }}
|
||||||
|
|
@ -156,22 +152,23 @@ jobs:
|
||||||
fi
|
fi
|
||||||
echo "tag $tag already exists on $sha — joining"
|
echo "tag $tag already exists on $sha — joining"
|
||||||
elif [ "$code" = "404" ]; then
|
elif [ "$code" = "404" ]; then
|
||||||
# Create the tag with a real `git push`, not POST /tags.
|
python3 -c "import json,sys; json.dump({'tag_name':sys.argv[1],'target':sys.argv[2],'message':'OnionWire '+sys.argv[1]}, sys.stdout)" \
|
||||||
# A tag pushed by git fires the `push: tags: v*.*.*` trigger
|
"$tag" "$sha" > /tmp/tag-create.json
|
||||||
# that android-release.yml listens on; a tag created through
|
echo "tag-create payload $(wc -c < /tmp/tag-create.json) bytes"
|
||||||
# the API does not (verified on this instance: the v0.2.0 tag
|
create_code=$(api_curl -o /tmp/tag-created.json -w '%{http_code}' \
|
||||||
# created by POST /tags produced no android-release run).
|
-X POST -H "Content-Type: application/json" \
|
||||||
git config user.name "onionwire-ci"
|
--data-binary @/tmp/tag-create.json \
|
||||||
git config user.email "onionwire-ci@localhost"
|
"$REPO_API/tags")
|
||||||
git tag -a "$tag" "$sha" -m "OnionWire $tag"
|
if [ "$create_code" = "201" ]; then
|
||||||
push_url="https://sirius:${FORGEJO_TOKEN}@${GIT_URL#https://}"
|
created=true
|
||||||
if ! git push "$push_url" "refs/tags/$tag" 2>&1 \
|
echo "created tag $tag on $sha"
|
||||||
| sed "s|${FORGEJO_TOKEN}|***|g"; then
|
elif [ "$create_code" = "409" ]; then
|
||||||
echo "creating tag $tag on $sha failed" >&2
|
echo "tag $tag created concurrently — joining"
|
||||||
|
else
|
||||||
|
echo "creating tag $tag failed HTTP $create_code" >&2
|
||||||
|
cat /tmp/tag-created.json >&2 || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
created=true
|
|
||||||
echo "created tag $tag on $sha (git push)"
|
|
||||||
else
|
else
|
||||||
echo "GET tags/$tag failed HTTP $code" >&2
|
echo "GET tags/$tag failed HTTP $code" >&2
|
||||||
cat /tmp/tag.json >&2 || true
|
cat /tmp/tag.json >&2 || true
|
||||||
|
|
|
||||||
14
README.md
14
README.md
|
|
@ -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:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue