ci: release on GitHub-hosted runners
Move the tag-triggered release pipeline from .gitea/workflows to .github/workflows for github.com/ELY-Open-Source/Kigi-CLI: - ubuntu-latest (x86_64 linux), ubuntu-24.04-arm (native aarch64 linux), macos-latest (both darwin targets), windows-latest (msvc). - gh release with GITHUB_TOKEN keeps the draft -> per-target upload -> SHA256SUMS -> publish ordering and the kigi-<version>-<triple> asset names. - upload/download-artifact v4 for the checksum lines. - docs/RELEASE.md: GitHub runner layout replaces the Gitea runner setup. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
3 files changed
+291
-501
No files matched your search
+36
-126
@@ -1,13 +1,11 @@
|
||||
# Release checklist (PRD F8)
|
||||
|
||||
Kigi ships as a single-file binary for five targets, published on this
|
||||
repo's Gitea Releases by `.gitea/workflows/release.yml`. Users install via
|
||||
`install.sh` / `install.ps1` and stay current through the in-app
|
||||
self-updater (`kigi-update`), which resolves the same Releases API.
|
||||
|
||||
`.github/workflows/release.yml` is the retired GitHub pipeline. Gitea ignores
|
||||
`.github/workflows` entirely whenever `.gitea/workflows` is non-empty, so it
|
||||
does not run — it is kept only as a reference for the GitHub-hosted layout.
|
||||
repo's GitHub Releases
|
||||
(<https://github.com/ELY-Open-Source/Kigi-CLI/releases>) by
|
||||
`.github/workflows/release.yml`. Users install via `install.sh` /
|
||||
`install.ps1` and stay current through the in-app self-updater
|
||||
(`kigi-update`), which resolves the same Releases API.
|
||||
|
||||
## Cutting a release
|
||||
|
||||
@@ -34,15 +32,15 @@ does not run — it is kept only as a reference for the GitHub-hosted layout.
|
||||
`release-dist` profile, packages
|
||||
`kigi-<version>-<target-triple>.{tar.gz|zip}` archives (binary +
|
||||
LICENSE + NOTICE + THIRD-PARTY-NOTICES), generates `SHA256SUMS`, and
|
||||
publishes the Gitea Release. Tags containing `-` (e.g.
|
||||
publishes the GitHub Release. Tags containing `-` (e.g.
|
||||
`v0.2.0-alpha.1`) publish as pre-releases, which only the `alpha`
|
||||
update channel picks up.
|
||||
|
||||
The release is created as a **draft** and only flipped public once
|
||||
`SHA256SUMS` is attached, so `releases/latest` never hands the installer
|
||||
a release whose checksum manifest is still missing. A failed run leaves
|
||||
the draft in place; re-pushing the tag reuses it rather than erroring on
|
||||
a duplicate `tag_name`.
|
||||
the draft in place; re-running the workflow reuses it rather than
|
||||
erroring on a duplicate `tag_name`.
|
||||
5. Smoke-test an installed artifact:
|
||||
|
||||
```sh
|
||||
@@ -52,127 +50,39 @@ does not run — it is kept only as a reference for the GitHub-hosted layout.
|
||||
|
||||
## Build runners
|
||||
|
||||
Gitea has no hosted runners, so all three `runs-on` labels below are machines
|
||||
we register ourselves with `gitea-runner` (the binary formerly called
|
||||
`act_runner`). Labels are declared in the runner's `config.yaml` as
|
||||
`<label>:host` (run directly on the machine) or `<label>:docker://<image>` (run
|
||||
in a container) — with `gitea-runner` v2, `register --labels` is ignored
|
||||
whenever a config file supplies them.
|
||||
Every leg runs on a GitHub-hosted runner; none needs local state, so no
|
||||
self-hosted runner is involved. The repo is public, so keep it that way: a
|
||||
self-hosted runner must never be reachable from a `pull_request` event, and
|
||||
this workflow only triggers on tag pushes.
|
||||
|
||||
| Label | Machine | Mode | Builds |
|
||||
| ---------------- | ------------------------------ | ------ | -------------------------------------------------- |
|
||||
| `ubuntu-latest` | the Linux server | docker | `x86_64-unknown-linux-gnu`, `aarch64-unknown-linux-gnu` |
|
||||
| `macos-arm64` | Mac Mini (M4) | host | `aarch64-apple-darwin`, `x86_64-apple-darwin` |
|
||||
| `windows-amd64` | RaidenMei (Windows PC) | host | `x86_64-pc-windows-msvc` |
|
||||
| Runner | Builds |
|
||||
| ------------------ | ------------------------------------------------------- |
|
||||
| `ubuntu-latest` | `x86_64-unknown-linux-gnu` |
|
||||
| `ubuntu-24.04-arm` | `aarch64-unknown-linux-gnu` (native, no cross toolchain) |
|
||||
| `macos-latest` | `aarch64-apple-darwin`, `x86_64-apple-darwin` |
|
||||
| `windows-latest` | `x86_64-pc-windows-msvc` |
|
||||
|
||||
The Linux legs use `ubuntu-latest` because that is what the Linux server's
|
||||
runner already advertises. That image is a bare runner-image, so those legs
|
||||
provision their own apt packages and rustup per run (`rustup show` then picks
|
||||
up the `rust-toolchain.toml` pin). If you register a dedicated
|
||||
`linux-x86_64:docker://…` runner later, change the three Linux `runs-on`
|
||||
values back to match it.
|
||||
`macos-latest` is Apple Silicon; `x86_64-apple-darwin` is a cross-compile
|
||||
against the same SDK. The Darwin targets need the real Apple linker
|
||||
(`.cargo/config.toml` passes `-ObjC` and `-undefined dynamic_lookup`), so they
|
||||
cannot move to a Linux runner.
|
||||
|
||||
**The Mac is not optional.** Apple's SDK licence limits macOS builds to
|
||||
Apple-branded hardware, and the Darwin targets need the real Apple linker
|
||||
anyway (`.cargo/config.toml` passes `-ObjC` and `-undefined dynamic_lookup`).
|
||||
There is no supported way to produce our macOS artifacts on the Linux server.
|
||||
One Apple Silicon Mac covers both Darwin targets — `x86_64-apple-darwin` is a
|
||||
cross-compile against the same SDK, exactly as the old GitHub `macos-14`
|
||||
runner did it.
|
||||
`windows-latest` ships the VS Build Tools the static MSVC CRT link needs
|
||||
(`ring`, `mimalloc`, `zstd-sys` and `libz-sys` build with
|
||||
`-C target-feature=+crt-static`). Every job installs protoc
|
||||
(`PROTOC_VERSION`, matching the `bin/protoc` dotslash pin) and runs
|
||||
`rustup show` to materialise the `rust-toolchain.toml` pin; the arm64 Linux
|
||||
leg installs rustup first if the image lacks it.
|
||||
|
||||
Windows is a softer requirement but still wants a real machine: the tree links
|
||||
`ring`, `mimalloc`, `zstd-sys` and `libz-sys` against a static MSVC CRT
|
||||
(`-C target-feature=+crt-static`). Cross-compiling that from Linux with
|
||||
`cargo-xwin` is possible but means debugging four C builds under `clang-cl`;
|
||||
a Windows runner with the VS 2022 C++ Build Tools reproduces today's binary
|
||||
exactly.
|
||||
The release steps use the preinstalled `gh` CLI with `secrets.GITHUB_TOKEN`
|
||||
(`permissions: contents: write`): `gh release create --draft`, then
|
||||
`gh release upload` per target, then `SHA256SUMS` and
|
||||
`gh release edit --draft=false`. Only the five checksum lines travel through
|
||||
`actions/upload-artifact@v4`; the archives go straight to the release.
|
||||
|
||||
Linux arm64 *is* cross-compiled on the x86_64 box — the workflow installs
|
||||
`gcc-aarch64-linux-gnu` and points `cc-rs` at it. The one thing this loses is
|
||||
the ability to smoke-test the arm64 binary before publishing (the old GitHub
|
||||
pipeline did not test it either). Register a native arm64 runner and change
|
||||
that matrix leg's `runner:` if you want it built natively.
|
||||
|
||||
### Registering a runner
|
||||
|
||||
Get a registration token from **Settings → Actions → Runners** (repo scope),
|
||||
your user settings (all your repos) or the site admin panel (instance-wide).
|
||||
Over the API it is a **POST**, not a GET — a GET is parsed as runner id `0` and
|
||||
404s:
|
||||
|
||||
```sh
|
||||
curl -fsS -X POST -H "Authorization: token $GITEA_API_TOKEN" \
|
||||
https://git.zacharyzhang.com/api/v1/user/actions/runners/registration-token
|
||||
```
|
||||
|
||||
Write the labels into `config.yaml` first (see `runner.labels` in
|
||||
`gitea-runner generate-config`), then register on each machine:
|
||||
|
||||
```sh
|
||||
# Linux (the Linux server) — container mode
|
||||
gitea-runner --config config.yaml register --no-interactive \
|
||||
--instance https://git.zacharyzhang.com \
|
||||
--token <REGISTRATION_TOKEN> \
|
||||
--name kigi-linux-x86_64
|
||||
|
||||
# macOS (Apple Silicon) — host mode, needs Xcode CLT + rustup + Node on PATH
|
||||
gitea-runner --config config.yaml register --no-interactive \
|
||||
--instance https://git.zacharyzhang.com \
|
||||
--token <REGISTRATION_TOKEN> \
|
||||
--name kigi-macos-arm64
|
||||
|
||||
# Windows — host mode, needs VS 2022 Build Tools + rustup + Node on PATH
|
||||
gitea-runner --config config.yaml register --no-interactive `
|
||||
--instance https://git.zacharyzhang.com `
|
||||
--token <REGISTRATION_TOKEN> `
|
||||
--name kigi-windows-amd64
|
||||
```
|
||||
|
||||
Host-mode runners execute steps with the daemon's own environment, so each
|
||||
needs its build prerequisites installed up front — and the supervisor that
|
||||
launches the daemon must put them on `PATH`:
|
||||
|
||||
- **macOS**: `xcode-select --install`, `rustup`, and Node (for
|
||||
`actions/checkout`, which is a JavaScript action).
|
||||
- **Windows**: VS 2022 Build Tools with the "Desktop development with C++"
|
||||
workload, `rustup`, Git for Windows, and Node. Every Windows step in the
|
||||
workflow uses `shell: powershell` (5.1) — never `bash`, which on a normal
|
||||
Windows box resolves to WSL.
|
||||
- **Linux (docker mode)**: nothing on the host — the workflow installs
|
||||
`build-essential`, `jq`, `unzip`, protoc, rustup and the cross toolchain
|
||||
inside the container per run.
|
||||
|
||||
### Keeping the runners alive
|
||||
|
||||
Each host-mode runner is supervised so it survives reboots and crashes. Both
|
||||
supervisors export `CARGO_HOME`/`RUSTUP_HOME` and prepend the toolchain, git
|
||||
and node directories to `PATH`, because host-mode jobs inherit exactly the
|
||||
daemon's environment.
|
||||
|
||||
| Machine | Supervisor | Manage with |
|
||||
| -------- | --------------------------------------------- | ------------------------------------------------------ |
|
||||
| Windows | Task Scheduler task `Gitea Runner (Kigi)` running `C:\Users\zhang\gitea-runner\run-runner.ps1` | `Get-ScheduledTask`, `Start-ScheduledTask`, `Stop-ScheduledTask` |
|
||||
| macOS | LaunchAgent `com.kigi.gitea-runner` (`KeepAlive`) | `launchctl kickstart -k gui/$(id -u)/com.kigi.gitea-runner` |
|
||||
|
||||
`prompt.txt` at the repo root is a one-shot setup prompt for the Mac Mini leg.
|
||||
Both runners also expose a liveness probe on `http://127.0.0.1:9101/healthz`.
|
||||
|
||||
### Gitea-specific things that differ from GitHub
|
||||
|
||||
- Workflows live in `.gitea/workflows/`. Once that directory is non-empty,
|
||||
`.github/workflows/` is ignored completely — you cannot run both.
|
||||
- The automatic token is `secrets.GITEA_TOKEN`, and the release steps call the
|
||||
Gitea API directly (`POST /releases`, `POST /releases/{id}/assets`,
|
||||
`PATCH /releases/{id}`) rather than `softprops/action-gh-release`, which
|
||||
targets GitHub's API and does not work here.
|
||||
- `uses:` actions are fetched from `github.com` by default
|
||||
(`DEFAULT_ACTIONS_URL`), so the runners need outbound access to it — our
|
||||
GitHub *account* being suspended does not affect downloading public actions.
|
||||
Absolute URLs (`uses: https://gitea.com/actions/checkout@v4`) work too.
|
||||
- Artifacts carry only the five checksum lines; the archives themselves go
|
||||
straight to the release. If `actions/upload-artifact@v3` misbehaves on the
|
||||
instance, the fallback is to drop the artifact steps and have `publish`
|
||||
download the archives from the release and hash them there.
|
||||
Build caches come from `Swatinem/rust-cache`. GitHub only lets a tag run
|
||||
restore caches made on its own ref or the default branch, and nothing builds
|
||||
on `main`, so a tag build starts cold; the cache helps re-runs of the same tag.
|
||||
|
||||
## Invariants to keep in lockstep
|
||||
|
||||
|
||||
Reference in new issue
Block a user