Compare commits

..
Author SHA1 Message Date
563388d18d Merge pull request 'feat(android): chat row renders queued (try 3/8, retry 45s) from the SDK outbox rows' (#59) from wt/t_f8658427 into feat/sdk-outbox-rows
All checks were successful
ci / test (pull_request) Successful in 3m54s
ci / sdk (pull_request) Successful in 54s
Reviewed-on: #59
2026-09-12 23:09:43 +00:00
f35c16e4b0 Merge branch 'feat/sdk-outbox-rows' into wt/t_f8658427 2026-09-12 23:09:34 +00:00
febc963421 Merge pull request 'feat(sdk): ChatMessage.id — join a chat row to its outbox row' (#61) from wt/t_254f9025 into feat/sdk-outbox-rows
All checks were successful
ci / test (pull_request) Successful in 3m57s
ci / sdk (pull_request) Successful in 1m4s
Reviewed-on: #61
2026-09-12 23:09:06 +00:00
rust-dev
c969e60185
feat(sdk): ChatMessage.id — join a chat row to its outbox row
All checks were successful
ci / test (pull_request) Successful in 3m52s
ci / sdk (pull_request) Successful in 59s
`OutboxRow::message_id` documents itself as *the* join key (the
`messages.id` a `ChatMessage` belongs to), but the record carried no id,
so the Android client could only pair the two lists positionally.

Add `ChatMessage.id: i64` as the first field, copied straight from the
`messages.id` the store already selects. Additive over UniFFI: Kotlin
consumers only gain a constructor field and the bindings regenerate.

The id mapping moves into a `chat_message` helper so the join property is
testable without a Node: the new test builds a real store, queues an
outbox row for a message, and asserts the id on the message equals the
`message_id` the outbox row reports for that same row.

# Conflicts:
#	crates/onionwire-sdk/src/lib.rs
2026-09-12 18:17:06 -04:00
t
0999601e6a
feat(android): chat row renders queued (try 3/8, retry 45s) from the SDK's outbox rows
Consumes the SDK surface from PR #58 (`Wire.outbox(pubkeyHex)` →
`OutboxRow { messageId, status, attempts, nextAttemptAt, lastError }` and
`outboxMaxAttempts()`): a queued chat row now says *why* it is still queued
instead of a flat `queued`.

* `OutboxDetail.kt` — `retryInText` mirrors `src/tui.rs::retry_in_text`
  (`<= 0` → `retry now`; `< 60` → `retry {n}s`; else `retry {ceil-minutes}m`),
  and `outboxDetails` joins the SDK's rows onto the chat rows. The denominator
  is the core's `outboxMaxAttempts()`/`Rust` budget, fetched once — never 8.
* A terminal `"failed"` row keeps the marker's own `failed: <reason>` and gets
  **no** countdown: `nextAttemptAt` on a failed row is the last time it was
  scheduled for, so a countdown there would promise an attempt that never comes.
  `"sending"` stays bare, matching the TUI.
* `ChatScreen` polls the outbox rows on the same 2s cadence as the bodies and
  renders the countdown against an injectable `nowSeconds` (the store holds an
  absolute instant, the app computes the age).
* The join is positional — `ChatMessage` carries no `messages.id` — and
  fail-closed: mismatched row counts, an unknown status, or a status that
  contradicts the one the SDK resolved for that message drops every detail and
  leaves the flat markers. `ChatMessage.id` would remove the positional part;
  filed as follow-up.
* `OutboxDetailTest` (17 tests) asserts the three `retry_in_text` buckets, the
  `queued (try 3/8, retry 45s)` wording, that a failed row shows no countdown,
  that the denominator comes from the caller, and the three fail-closed cases.
  32 unit tests, 0 failures.

Android base: PR #56 (`feat/android-outbox-state`, t_f46a9863) — the Android
half of the #52/#56 duplicate pair, which is not merged here. SDK base: PR #58
on PR #51.
2026-09-12 18:17:05 -04:00
rust-dev (hermes)
cce0721ba9
feat(sdk): expose the outbox rows behind a queued chat message
All checks were successful
ci / test (pull_request) Successful in 3m57s
ci / sdk (pull_request) Successful in 1m1s
The TUI can say why a queued row is still queued ('queued (try n/8,
retry 45s)') because it reads OutboxEntry::attempts and next_attempt_at
directly. The SDK exposed neither: ChatMessage.delivery is a flat
'queued'/'sending'/'failed: <reason>' string and Wire had no outbox
accessor, so an Android chat row could only invent a countdown.

Adds OutboxRow { message_id, status, attempts, next_attempt_at,
last_error } and Wire::outbox(pubkey_hex) over Node::outbox_pending, plus
outbox_max_attempts() so the client renders 'try n/8' against the core's
own budget instead of a hardcoded 8. Additive: Wire::send() and
ChatMessage.delivery are untouched.

# Conflicts:
#	crates/onionwire-sdk/src/lib.rs
2026-09-12 18:17:04 -04:00
agent
381f424733
fix(sdk): surface Sent/Queued on send(), and build the SDK in CI
All checks were successful
ci / test (pull_request) Successful in 3m56s
ci / sdk (pull_request) Successful in 1m6s
Node::send() became Result<OutboxStatus, String> in the local-outbox work,
which broke crates/onionwire-sdk — and nothing noticed, because the SDK is a
separate cargo workspace that root CI never compiles.

- Wire::send() returns WResult<SendState> (Sent | Queued)
- ChatMessage.delivery for outgoing rows
- New sdk job in ci.yml (own target volume; rustls workspace)
- Refresh SDK Cargo.lock + README (SQLCipher / outbox facts)

Rebased onto main after #50/#54: no src/node.rs changes (WAL checkpoint lives
in Store now). README at-rest claims kept from #55.
2026-09-12 18:16:21 -04:00
5 changed files with 39 additions and 253 deletions

View file

@ -14,21 +14,19 @@ 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:

View file

@ -1,33 +1,23 @@
name: release name: release
# Manual, batched releases. There is deliberately NO push trigger: a merged # Auto-tag and publish both Linux binaries when core paths land on main.
# PR does not mint a release. A maintainer dispatches this at a stopping point # Tag-push is intentionally NOT a trigger: this workflow creates the tag via
# (a batch of work has landed and CI is green on main) — see docs/RELEASING.md. # the API, and a tag-push hook would start a second run of the same release.
# Tag-push is intentionally NOT a trigger here: this workflow creates the tag # Rebuild an existing tag (or dry-run a build) with workflow_dispatch.
# via the API, and a tag-push hook would start a second run of the same release. # Version: latest v*.*.* tag → patch+1; zero tags → v0.1.0.
# (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 = create the next version) description: Existing tag to (re)build and publish (empty = next version)
required: false required: false
type: string type: string
dry_run: dry_run:
@ -67,8 +57,6 @@ 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: |
@ -81,7 +69,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_version=${INPUT_VERSION-} input_tag=${INPUT_TAG-} input_bump=${INPUT_BUMP-} input_dry_run=${INPUT_DRY_RUN-} dry_run=$dry_run" echo "event=$EVENT_NAME sha=$EVENT_SHA input_tag=${INPUT_TAG-} 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 \
@ -90,13 +78,6 @@ 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")
@ -110,33 +91,8 @@ 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
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 '')") 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 [ -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

View file

@ -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`) 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. 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.
**x86_64 (most PCs / VMs):** **x86_64 (most PCs / VMs):**
@ -266,38 +266,20 @@ rationale, the 16 KB page-size check and the signing story are in
## Releases (maintainers) ## Releases (maintainers)
Releases are **manual and batched**: no merge publishes anything, and neither A core change on `main` is enough. The release workflow computes the next
does a tag push. Cut one when a batch of work has reached a stopping point — `v*.*.*` tag (patch+1, or `v0.1.0` if there are no tags), creates it via the
CI green on `main`, the feature set landed, no half-merged stack. Full policy API, builds aarch64 on the Pi runner and x86_64 on the amd64 runner, and
and procedure: [`docs/RELEASING.md`](docs/RELEASING.md) — it is two dispatches, publishes all four assets (`onionwire-<target>` + `.sha256`) to one release.
`release` (tag + Linux binaries) then `android-release` with that tag (APK + Do not push tags by hand — a tag-push trigger would start a second run.
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
``` ```
@ -305,7 +287,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) — 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`. - [`.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`.
Scripts: Scripts:

View file

@ -12,5 +12,3 @@ 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.

View file

@ -1,148 +0,0 @@
# 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.