Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4b824a83d |
||
|
|
f2dcd79d5c |
||
| 997b554bf1 | |||
| 7f8a1959df | |||
|
2cf055c1e8 |
|||
|
7435ce42f5 |
|||
| 0c12abfa32 | |||
| 70ae597abc | |||
|
6c9fd00b8a |
5 changed files with 253 additions and 39 deletions
|
|
@ -14,19 +14,21 @@ name: android-release
|
||||||
# First automated version with zero tags: v0.1.0. Afterwards, patch+1 from the
|
# 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 —
|
# 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 automatic trigger, on purpose. Two candidate decoupled triggers were
|
||||||
|
# tried and both dead-end on Forgejo 10.0.3 (see docs/RELEASING.md):
|
||||||
|
# - `push: tags: ['v*.*.*']` — a tag created by release.yml (API or git push)
|
||||||
|
# does not fire it: pushes made with the CI's token are Actions-user events
|
||||||
|
# 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:
|
|
||||||
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"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,33 @@
|
||||||
name: release
|
name: release
|
||||||
|
|
||||||
# Auto-tag and publish both Linux binaries when core paths land on main.
|
# Manual, batched releases. There is deliberately NO push trigger: a merged
|
||||||
# Tag-push is intentionally NOT a trigger: this workflow creates the tag via
|
# PR does not mint a release. A maintainer dispatches this at a stopping point
|
||||||
# the API, and a tag-push hook would start a second run of the same release.
|
# (a batch of work has landed and CI is green on main) — see docs/RELEASING.md.
|
||||||
# Rebuild an existing tag (or dry-run a build) with workflow_dispatch.
|
# Tag-push is intentionally NOT a trigger here: this workflow creates the tag
|
||||||
# Version: latest v*.*.* tag → patch+1; zero tags → v0.1.0.
|
# via the API, and a tag-push hook would start a second run of the same release.
|
||||||
|
# (A tag this workflow creates does not wake android-release.yml either — see
|
||||||
|
# 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
|
||||||
|
# (default minor — a batched release is usually a feature set); zero tags → v0.1.0.
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- "src/**"
|
|
||||||
- "crates/**"
|
|
||||||
- "Cargo.toml"
|
|
||||||
- "Cargo.lock"
|
|
||||||
- "scripts/release-body.md"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
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:
|
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
|
required: false
|
||||||
type: string
|
type: string
|
||||||
dry_run:
|
dry_run:
|
||||||
|
|
@ -57,6 +67,8 @@ jobs:
|
||||||
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||||
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_VERSION: ${{ github.event.inputs.version }}
|
||||||
INPUT_TAG: ${{ github.event.inputs.tag }}
|
INPUT_TAG: ${{ github.event.inputs.tag }}
|
||||||
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
|
INPUT_DRY_RUN: ${{ github.event.inputs.dry_run }}
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -69,7 +81,7 @@ jobs:
|
||||||
true|True|TRUE|1|yes|YES) dry_run=true ;;
|
true|True|TRUE|1|yes|YES) dry_run=true ;;
|
||||||
esac
|
esac
|
||||||
fi
|
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() {
|
api_curl() {
|
||||||
curl -sS --http1.1 --retry 5 --retry-all-errors --retry-delay 3 \
|
curl -sS --http1.1 --retry 5 --retry-all-errors --retry-delay 3 \
|
||||||
|
|
@ -78,6 +90,13 @@ jobs:
|
||||||
}
|
}
|
||||||
|
|
||||||
input_tag="${INPUT_TAG:-}"
|
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
|
if [ -n "$input_tag" ]; then
|
||||||
code=$(api_curl -o /tmp/tag.json -w '%{http_code}' \
|
code=$(api_curl -o /tmp/tag.json -w '%{http_code}' \
|
||||||
"$REPO_API/tags/$input_tag")
|
"$REPO_API/tags/$input_tag")
|
||||||
|
|
@ -91,8 +110,33 @@ jobs:
|
||||||
created=false
|
created=false
|
||||||
echo "re-publish existing tag $tag at $sha (dry_run=$dry_run)"
|
echo "re-publish existing tag $tag at $sha (dry_run=$dry_run)"
|
||||||
else
|
else
|
||||||
|
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
|
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))")
|
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"
|
sha="$EVENT_SHA"
|
||||||
created=false
|
created=false
|
||||||
if [ "$dry_run" = "true" ]; then
|
if [ "$dry_run" = "true" ]; then
|
||||||
|
|
|
||||||
40
README.md
40
README.md
|
|
@ -25,7 +25,7 @@ Arti onion services are still **experimental**. If the hidden service cannot com
|
||||||
|
|
||||||
### Option A — download a release binary
|
### 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):**
|
**x86_64 (most PCs / VMs):**
|
||||||
|
|
||||||
|
|
@ -266,20 +266,38 @@ rationale, the 16 KB page-size check and the signing story are in
|
||||||
|
|
||||||
## Releases (maintainers)
|
## Releases (maintainers)
|
||||||
|
|
||||||
A core change on `main` is enough. The release workflow computes the next
|
Releases are **manual and batched**: no merge publishes anything, and neither
|
||||||
`v*.*.*` tag (patch+1, or `v0.1.0` if there are no tags), creates it via the
|
does a tag push. Cut one when a batch of work has reached a stopping point —
|
||||||
API, builds aarch64 on the Pi runner and x86_64 on the amd64 runner, and
|
CI green on `main`, the feature set landed, no half-merged stack. Full policy
|
||||||
publishes all four assets (`onionwire-<target>` + `.sha256`) to one release.
|
and procedure: [`docs/RELEASING.md`](docs/RELEASING.md) — it is two dispatches,
|
||||||
Do not push tags by hand — a tag-push trigger would start a second run.
|
`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:
|
||||||
|
|
||||||
|
| 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. Then dispatch `android-release` with that tag to
|
||||||
|
attach the APK + AAR to the same release (it has no automatic trigger on this
|
||||||
|
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
|
||||||
|
nothing.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# optional: keep Cargo.toml in sync with the tag the workflow will mint
|
# optional: keep Cargo.toml in sync with the tag the workflow will mint
|
||||||
# (the workflow does not edit Cargo.toml)
|
# (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)
|
# offline x86_64 fallback (idempotent — safe to re-run)
|
||||||
FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
|
FORGEJO_TOKEN=<pat> scripts/build-release-local.sh vX.Y.Z
|
||||||
```
|
```
|
||||||
|
|
@ -287,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) — two jobs on the Pi runner (`docker` label), serialized by `onionwire-ci-pi`. `test`: `cargo test --locked` + `cargo clippy --all-targets -- -D warnings` at the repo root. `sdk`: the same for `crates/onionwire-sdk` (separate cargo workspace — own `Cargo.lock`, root crate by path, `rustls` instead of `native-tls` — so a root signature change cannot silently break the Android SDK). Both run 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.
|
- [`.forgejo/workflows/ci.yml`](.forgejo/workflows/ci.yml) — two jobs on the Pi runner (`docker` label), serialized by `onionwire-ci-pi`. `test`: `cargo test --locked` + `cargo clippy --all-targets -- -D warnings` at the repo root. `sdk`: the same for `crates/onionwire-sdk` (separate cargo workspace — own `Cargo.lock`, root crate by path, `rustls` instead of `native-tls` — so a root signature change cannot silently break the Android SDK). Both run 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.
|
||||||
- [`.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. 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:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
Operator / product docs stay in the [root README](../README.md). Android
|
||||||
build notes: [android/README.md](../android/README.md). SDK:
|
build notes: [android/README.md](../android/README.md). SDK:
|
||||||
[crates/onionwire-sdk/README.md](../crates/onionwire-sdk/README.md).
|
[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.
|
||||||
|
|
|
||||||
148
docs/RELEASING.md
Normal file
148
docs/RELEASING.md
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
# 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. **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
|
||||||
|
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
|
||||||
|
|
||||||
|
A release is **two dispatches**. After the core run has created the tag and
|
||||||
|
published the Linux binaries:
|
||||||
|
|
||||||
|
1. Actions → **android-release** → *Run workflow*, `tag=vX.Y.Z` (the tag the
|
||||||
|
core just created; leave `dry_run` false).
|
||||||
|
2. Check the release again — the APK + AAR + `.sha256` are attached to the
|
||||||
|
**same** tag. If the release did not exist yet it is created; if it exists
|
||||||
|
it is joined (`publish-release.sh` is 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.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
|
||||||
|
|
||||||
|
- **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