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
@@ -1,375 +0,0 @@
|
|||||||
name: Release
|
|
||||||
|
|
||||||
# PRD F8, Gitea edition. On a v* tag push, build the single-file kigi binary
|
|
||||||
# for the five supported targets, package kigi-<version>-<target-triple>.
|
|
||||||
# {tar.gz|zip} (binary + LICENSE + NOTICE + THIRD-PARTY-NOTICES), and publish
|
|
||||||
# them as a Gitea Release alongside SHA256SUMS. install.sh, install.ps1 and
|
|
||||||
# auto_update::release_asset_name() all resolve these exact names — keep the
|
|
||||||
# naming in lockstep with them.
|
|
||||||
#
|
|
||||||
# RUNNERS. Gitea has no hosted runners; every label below must be a runner you
|
|
||||||
# registered yourself (docs/RELEASE.md has the register commands):
|
|
||||||
#
|
|
||||||
# ubuntu-latest Linux x86_64, container mode — the label the Linux server's
|
|
||||||
# runner already advertises. Builds both Linux targets;
|
|
||||||
# aarch64 is a cross-compile, so this leg installs the
|
|
||||||
# aarch64 GNU toolchain. Because the image is a bare
|
|
||||||
# runner-image, the Linux legs provision their own apt
|
|
||||||
# packages and rustup (see the provision steps below).
|
|
||||||
# Registering a dedicated `linux-x86_64:docker://...` runner
|
|
||||||
# instead is fine — swap the three labels back if you do.
|
|
||||||
# macos-arm64 Apple Silicon Mac, host mode. Builds both Darwin targets;
|
|
||||||
# x86_64 is a cross-compile against the same SDK. macOS
|
|
||||||
# CANNOT be built anywhere else — Apple's SDK licence
|
|
||||||
# restricts it to Apple hardware.
|
|
||||||
# windows-amd64 Windows x86_64, host mode, with VS 2022 Build Tools
|
|
||||||
# (C++ workload). Needed because the tree links ring,
|
|
||||||
# mimalloc, zstd-sys and libz-sys against a static MSVC CRT
|
|
||||||
# (-C target-feature=+crt-static).
|
|
||||||
#
|
|
||||||
# SHELLS. Every step names its shell explicitly and the Windows leg never uses
|
|
||||||
# bash. On a normal Windows box `bash` resolves to WSL (not Git Bash), and
|
|
||||||
# `pwsh` (PowerShell 7) is usually absent — so Windows steps use `powershell`,
|
|
||||||
# which is the built-in 5.1. Keep those steps 5.1-compatible: no `&&`, no
|
|
||||||
# ternary, no null-coalescing.
|
|
||||||
#
|
|
||||||
# Note: because this file exists, Gitea ignores .github/workflows entirely.
|
|
||||||
#
|
|
||||||
# PUBLISH ORDER. The release is created as a draft and only made public once
|
|
||||||
# SHA256SUMS is attached, so `releases/latest` never hands the installer a
|
|
||||||
# release whose checksum manifest is still missing.
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*"]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
# Matches the version pinned by the dotslash launcher in bin/protoc. That
|
|
||||||
# launcher is not used here: it has no Windows entry and needs a `cargo
|
|
||||||
# install dotslash` first, so every platform fetches protoc directly.
|
|
||||||
PROTOC_VERSION: "29.3"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prepare:
|
|
||||||
name: prepare draft release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
release_id: ${{ steps.draft.outputs.release_id }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Check tag matches workspace version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
tag_version="${GITHUB_REF_NAME#v}"
|
|
||||||
cargo_version="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1)"
|
|
||||||
if [ "$tag_version" != "$cargo_version" ]; then
|
|
||||||
echo "Tag $GITHUB_REF_NAME does not match workspace version $cargo_version" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create or reuse draft release
|
|
||||||
id: draft
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
# The runner-image is bare; jq and curl are both used below.
|
|
||||||
if ! command -v jq >/dev/null || ! command -v curl >/dev/null; then
|
|
||||||
SUDO=""; command -v sudo >/dev/null && SUDO=sudo
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
$SUDO apt-get update -qq
|
|
||||||
$SUDO apt-get install -y -qq --no-install-recommends jq curl ca-certificates
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Idempotent so a re-run of a failed tag build reuses the same draft
|
|
||||||
# instead of erroring on a duplicate tag_name.
|
|
||||||
existing="$(curl -sS -H "Authorization: token $TOKEN" \
|
|
||||||
"$API/releases/tags/$GITHUB_REF_NAME")"
|
|
||||||
release_id="$(printf '%s' "$existing" | jq -r '.id // empty')"
|
|
||||||
|
|
||||||
if [ -z "$release_id" ]; then
|
|
||||||
prerelease=false
|
|
||||||
case "$GITHUB_REF_NAME" in *-*) prerelease=true ;; esac
|
|
||||||
created="$(curl -fsS -X POST \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\",\"draft\":true,\"prerelease\":$prerelease}" \
|
|
||||||
"$API/releases")"
|
|
||||||
release_id="$(printf '%s' "$created" | jq -r '.id')"
|
|
||||||
echo "Created draft release $release_id (prerelease=$prerelease)"
|
|
||||||
else
|
|
||||||
echo "Reusing release $release_id for $GITHUB_REF_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: build (${{ matrix.target }})
|
|
||||||
needs: prepare
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- target: x86_64-unknown-linux-gnu
|
|
||||||
runner: ubuntu-latest
|
|
||||||
protoc: linux-x86_64
|
|
||||||
ext: tar.gz
|
|
||||||
linux: true
|
|
||||||
- target: aarch64-unknown-linux-gnu
|
|
||||||
runner: ubuntu-latest
|
|
||||||
protoc: linux-x86_64
|
|
||||||
ext: tar.gz
|
|
||||||
linux: true
|
|
||||||
cross_gnu: true
|
|
||||||
- target: aarch64-apple-darwin
|
|
||||||
runner: macos-arm64
|
|
||||||
protoc: osx-aarch_64
|
|
||||||
ext: tar.gz
|
|
||||||
- target: x86_64-apple-darwin
|
|
||||||
runner: macos-arm64
|
|
||||||
protoc: osx-aarch_64
|
|
||||||
ext: tar.gz
|
|
||||||
- target: x86_64-pc-windows-msvc
|
|
||||||
runner: windows-amd64
|
|
||||||
protoc: win64
|
|
||||||
ext: zip
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# ── linux container provisioning ──────────────────────────────────────
|
|
||||||
# The Linux legs run in a bare gitea runner-image, which ships git and
|
|
||||||
# node for the JavaScript actions but no compiler, no unzip (protoc) and
|
|
||||||
# no rustup. Host-mode macOS and Windows already have their toolchains
|
|
||||||
# installed, so this step is Linux-only.
|
|
||||||
- name: Provision Linux build deps
|
|
||||||
if: matrix.linux
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
SUDO=""; command -v sudo >/dev/null && SUDO=sudo
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
|
||||||
$SUDO apt-get update -qq
|
|
||||||
$SUDO apt-get install -y -qq --no-install-recommends \
|
|
||||||
build-essential pkg-config ca-certificates curl unzip tar jq
|
|
||||||
|
|
||||||
# ── protoc ────────────────────────────────────────────────────────────
|
|
||||||
- name: Install protoc (unix)
|
|
||||||
if: matrix.ext == 'tar.gz'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
url="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${{ matrix.protoc }}.zip"
|
|
||||||
curl -fsSL -o protoc.zip "$url"
|
|
||||||
rm -rf "$HOME/protoc"
|
|
||||||
unzip -q -o protoc.zip -d "$HOME/protoc"
|
|
||||||
chmod +x "$HOME/protoc/bin/protoc"
|
|
||||||
echo "$HOME/protoc/bin" >> "$GITHUB_PATH"
|
|
||||||
|
|
||||||
- name: Install protoc (windows)
|
|
||||||
if: matrix.ext == 'zip'
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
$url = "https://github.com/protocolbuffers/protobuf/releases/download/v$env:PROTOC_VERSION/protoc-$env:PROTOC_VERSION-${{ matrix.protoc }}.zip"
|
|
||||||
Invoke-WebRequest -Uri $url -OutFile protoc.zip
|
|
||||||
$dest = Join-Path $env:USERPROFILE "protoc"
|
|
||||||
if (Test-Path $dest) { Remove-Item $dest -Recurse -Force }
|
|
||||||
Expand-Archive protoc.zip -DestinationPath $dest -Force
|
|
||||||
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $dest "bin")
|
|
||||||
|
|
||||||
# ── toolchain ─────────────────────────────────────────────────────────
|
|
||||||
# rust-toolchain.toml pins the channel (1.97.0) and preinstalls both
|
|
||||||
# Linux targets; `rustup show` materialises exactly that.
|
|
||||||
- name: Install toolchain (unix)
|
|
||||||
if: matrix.ext == 'tar.gz'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
# No-op on the macOS host runner, which has rustup installed already.
|
|
||||||
# `--default-toolchain none` leaves the channel choice to
|
|
||||||
# rust-toolchain.toml, which `rustup show` then materialises.
|
|
||||||
if ! command -v rustup >/dev/null; then
|
|
||||||
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs \
|
|
||||||
| sh -s -- -y --no-modify-path --profile minimal --default-toolchain none
|
|
||||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
fi
|
|
||||||
rustup show
|
|
||||||
rustup target add ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Install toolchain (windows)
|
|
||||||
if: matrix.ext == 'zip'
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
rustup show
|
|
||||||
rustup target add ${{ matrix.target }}
|
|
||||||
|
|
||||||
# ring, mimalloc, zstd-sys and libz-sys are all cc-rs builds, so the
|
|
||||||
# cross target needs its own C toolchain — cc-rs picks these up from the
|
|
||||||
# target-suffixed vars.
|
|
||||||
- name: Install aarch64 cross toolchain
|
|
||||||
if: matrix.cross_gnu
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
SUDO=""; command -v sudo >/dev/null && SUDO=sudo
|
|
||||||
$SUDO apt-get update -qq
|
|
||||||
$SUDO apt-get install -y -qq gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
||||||
{
|
|
||||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc"
|
|
||||||
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc"
|
|
||||||
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++"
|
|
||||||
echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar"
|
|
||||||
} >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
# ── build ─────────────────────────────────────────────────────────────
|
|
||||||
- name: Build kigi (unix)
|
|
||||||
if: matrix.ext == 'tar.gz'
|
|
||||||
shell: bash
|
|
||||||
run: cargo build --profile release-dist -p kigi-bin --locked --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Build kigi (windows)
|
|
||||||
if: matrix.ext == 'zip'
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
cargo build --profile release-dist -p kigi-bin --locked --target ${{ matrix.target }}
|
|
||||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
||||||
|
|
||||||
# ── package, upload, checksum ─────────────────────────────────────────
|
|
||||||
# Archives go straight to the release rather than through the artifact
|
|
||||||
# store: they are large, and the release is the only place install.sh
|
|
||||||
# can read them from anyway. Only the checksum line travels as an
|
|
||||||
# artifact, for the publish job to concatenate.
|
|
||||||
- name: Package and upload (unix)
|
|
||||||
if: matrix.ext == 'tar.gz'
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
version="${GITHUB_REF_NAME#v}"
|
|
||||||
archive="kigi-${version}-${{ matrix.target }}.tar.gz"
|
|
||||||
staging="$(mktemp -d)"
|
|
||||||
cp "target/${{ matrix.target }}/release-dist/kigi" "$staging/kigi"
|
|
||||||
cp LICENSE "$staging/"
|
|
||||||
[ -f NOTICE ] && cp NOTICE "$staging/"
|
|
||||||
for f in THIRD-PARTY-NOTICES THIRD-PARTY-NOTICES.md; do
|
|
||||||
[ -f "$f" ] && cp "$f" "$staging/"
|
|
||||||
done
|
|
||||||
tar -C "$staging" -czf "$archive" .
|
|
||||||
|
|
||||||
curl -fsS -X POST \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-F "attachment=@${archive}" \
|
|
||||||
"$API/releases/$RELEASE_ID/assets?name=${archive}" > /dev/null
|
|
||||||
echo "Uploaded $archive"
|
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null; then
|
|
||||||
sha256sum "$archive" > "checksum-${{ matrix.target }}.txt"
|
|
||||||
else
|
|
||||||
shasum -a 256 "$archive" > "checksum-${{ matrix.target }}.txt"
|
|
||||||
fi
|
|
||||||
cat "checksum-${{ matrix.target }}.txt"
|
|
||||||
|
|
||||||
- name: Package and upload (windows)
|
|
||||||
if: matrix.ext == 'zip'
|
|
||||||
shell: powershell
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
$version = $env:GITHUB_REF_NAME.TrimStart("v")
|
|
||||||
$archive = "kigi-$version-${{ matrix.target }}.zip"
|
|
||||||
$staging = Join-Path $env:RUNNER_TEMP "staging"
|
|
||||||
if (Test-Path $staging) { Remove-Item $staging -Recurse -Force }
|
|
||||||
New-Item -ItemType Directory -Force -Path $staging | Out-Null
|
|
||||||
Copy-Item "target/${{ matrix.target }}/release-dist/kigi.exe" (Join-Path $staging "kigi.exe")
|
|
||||||
Copy-Item LICENSE $staging
|
|
||||||
if (Test-Path NOTICE) { Copy-Item NOTICE $staging }
|
|
||||||
foreach ($f in @("THIRD-PARTY-NOTICES", "THIRD-PARTY-NOTICES.md")) {
|
|
||||||
if (Test-Path $f) { Copy-Item $f $staging }
|
|
||||||
}
|
|
||||||
Compress-Archive -Path (Join-Path $staging "*") -DestinationPath $archive -Force
|
|
||||||
|
|
||||||
# System32\curl.exe, not PowerShell's `curl` alias for
|
|
||||||
# Invoke-WebRequest, which cannot do multipart uploads.
|
|
||||||
$api = "$env:API/releases/$env:RELEASE_ID/assets?name=$archive"
|
|
||||||
& "$env:SystemRoot\System32\curl.exe" -fsS -X POST `
|
|
||||||
-H "Authorization: token $env:TOKEN" `
|
|
||||||
-F "attachment=@$archive" $api
|
|
||||||
if ($LASTEXITCODE -ne 0) { throw "asset upload failed ($LASTEXITCODE)" }
|
|
||||||
Write-Host "Uploaded $archive"
|
|
||||||
|
|
||||||
# sha256sum's exact format, so the publish job can just concatenate.
|
|
||||||
# ASCII keeps the BOM out — a BOM would corrupt the first hash.
|
|
||||||
$hash = (Get-FileHash -Algorithm SHA256 -Path $archive).Hash.ToLowerInvariant()
|
|
||||||
"$hash $archive" | Out-File -FilePath "checksum-${{ matrix.target }}.txt" -Encoding ascii
|
|
||||||
Get-Content "checksum-${{ matrix.target }}.txt"
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: checksum-${{ matrix.target }}
|
|
||||||
path: checksum-${{ matrix.target }}.txt
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
publish:
|
|
||||||
name: publish release
|
|
||||||
needs: [prepare, build]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
path: checksums
|
|
||||||
|
|
||||||
- name: Assemble SHA256SUMS
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
# download-artifact v3 nests each artifact in its own directory. The
|
|
||||||
# Windows line arrives CRLF-terminated; strip CR so every line is LF
|
|
||||||
# for install.sh's `read -r hash name`.
|
|
||||||
find checksums -name 'checksum-*.txt' -exec cat {} + \
|
|
||||||
| tr -d '\r' | grep -v '^$' | sort -k2 > SHA256SUMS
|
|
||||||
lines="$(wc -l < SHA256SUMS)"
|
|
||||||
if [ "$lines" -ne 5 ]; then
|
|
||||||
echo "expected 5 checksum lines, got $lines" >&2
|
|
||||||
cat SHA256SUMS >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
cat SHA256SUMS
|
|
||||||
|
|
||||||
- name: Attach SHA256SUMS and publish
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
|
||||||
RELEASE_ID: ${{ needs.prepare.outputs.release_id }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
curl -fsS -X POST \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-F "attachment=@SHA256SUMS" \
|
|
||||||
"$API/releases/$RELEASE_ID/assets?name=SHA256SUMS" > /dev/null
|
|
||||||
|
|
||||||
# Flip the draft public only now that every asset install.sh looks
|
|
||||||
# for is attached.
|
|
||||||
curl -fsS -X PATCH \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"draft":false}' \
|
|
||||||
"$API/releases/$RELEASE_ID" > /dev/null
|
|
||||||
echo "Published $GITHUB_REF_NAME"
|
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
# PRD F8. On a v* tag push, build the single-file kigi binary for the five
|
||||||
|
# supported targets, package kigi-<version>-<target-triple>.{tar.gz|zip}
|
||||||
|
# (binary + LICENSE + NOTICE + THIRD-PARTY-NOTICES), and publish them as a
|
||||||
|
# GitHub Release alongside SHA256SUMS. install.sh, install.ps1 and
|
||||||
|
# auto_update::release_asset_name() all resolve these exact names — keep the
|
||||||
|
# naming in lockstep with them.
|
||||||
|
#
|
||||||
|
# RUNNERS. GitHub-hosted only; no job needs local state, and the repo is
|
||||||
|
# public, so nothing here may move to a self-hosted runner.
|
||||||
|
#
|
||||||
|
# ubuntu-latest x86_64-unknown-linux-gnu
|
||||||
|
# ubuntu-24.04-arm aarch64-unknown-linux-gnu, built natively (no cross C
|
||||||
|
# toolchain for ring, mimalloc, zstd-sys, libz-sys)
|
||||||
|
# macos-latest both Darwin targets; the runner is arm64, so x86_64 is
|
||||||
|
# a cross-compile against the same SDK
|
||||||
|
# windows-latest x86_64-pc-windows-msvc (VS Build Tools preinstalled,
|
||||||
|
# needed for the static MSVC CRT link)
|
||||||
|
#
|
||||||
|
# PUBLISH ORDER. The release is created as a draft and only made public once
|
||||||
|
# SHA256SUMS is attached, so `releases/latest` never hands the installer a
|
||||||
|
# release whose checksum manifest is still missing.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
# Matches the version pinned by the dotslash launcher in bin/protoc. That
|
||||||
|
# launcher is not used here: it has no Windows entry and needs a `cargo
|
||||||
|
# install dotslash` first, so every platform fetches protoc directly.
|
||||||
|
PROTOC_VERSION: "29.3"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
name: prepare draft release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check tag matches workspace version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
tag_version="${GITHUB_REF_NAME#v}"
|
||||||
|
cargo_version="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1)"
|
||||||
|
if [ "$tag_version" != "$cargo_version" ]; then
|
||||||
|
echo "Tag $GITHUB_REF_NAME does not match workspace version $cargo_version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Idempotent so a re-run of a failed tag build reuses the same draft
|
||||||
|
# instead of erroring on a duplicate tag_name.
|
||||||
|
- name: Create or reuse draft release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then
|
||||||
|
echo "Reusing release $GITHUB_REF_NAME"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
prerelease=""
|
||||||
|
case "$GITHUB_REF_NAME" in *-*) prerelease="--prerelease" ;; esac
|
||||||
|
gh release create "$GITHUB_REF_NAME" --draft --verify-tag \
|
||||||
|
--title "$GITHUB_REF_NAME" --generate-notes $prerelease
|
||||||
|
echo "Created draft release $GITHUB_REF_NAME ${prerelease}"
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: build (${{ matrix.target }})
|
||||||
|
needs: prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-latest
|
||||||
|
protoc: linux-x86_64
|
||||||
|
ext: tar.gz
|
||||||
|
- target: aarch64-unknown-linux-gnu
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
|
protoc: linux-aarch_64
|
||||||
|
ext: tar.gz
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
runner: macos-latest
|
||||||
|
protoc: osx-aarch_64
|
||||||
|
ext: tar.gz
|
||||||
|
- target: x86_64-apple-darwin
|
||||||
|
runner: macos-latest
|
||||||
|
protoc: osx-aarch_64
|
||||||
|
ext: tar.gz
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
runner: windows-latest
|
||||||
|
protoc: win64
|
||||||
|
ext: zip
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# ── protoc ────────────────────────────────────────────────────────────
|
||||||
|
- name: Install protoc (unix)
|
||||||
|
if: matrix.ext == 'tar.gz'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
url="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${{ matrix.protoc }}.zip"
|
||||||
|
curl -fsSL -o protoc.zip "$url"
|
||||||
|
rm -rf "$HOME/protoc"
|
||||||
|
unzip -q -o protoc.zip -d "$HOME/protoc"
|
||||||
|
chmod +x "$HOME/protoc/bin/protoc"
|
||||||
|
echo "$HOME/protoc/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Install protoc (windows)
|
||||||
|
if: matrix.ext == 'zip'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$url = "https://github.com/protocolbuffers/protobuf/releases/download/v$env:PROTOC_VERSION/protoc-$env:PROTOC_VERSION-${{ matrix.protoc }}.zip"
|
||||||
|
Invoke-WebRequest -Uri $url -OutFile protoc.zip
|
||||||
|
$dest = Join-Path $env:USERPROFILE "protoc"
|
||||||
|
if (Test-Path $dest) { Remove-Item $dest -Recurse -Force }
|
||||||
|
Expand-Archive protoc.zip -DestinationPath $dest -Force
|
||||||
|
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $dest "bin")
|
||||||
|
|
||||||
|
# ── toolchain ─────────────────────────────────────────────────────────
|
||||||
|
# rust-toolchain.toml pins the channel (1.97.0); `rustup show`
|
||||||
|
# materialises exactly that.
|
||||||
|
- name: Install toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
# The arm64 Linux image is not guaranteed to ship rustup.
|
||||||
|
# `--default-toolchain none` leaves the channel choice to
|
||||||
|
# rust-toolchain.toml.
|
||||||
|
if ! command -v rustup >/dev/null; then
|
||||||
|
curl --proto '=https' --tlsv1.2 -fsSL https://sh.rustup.rs \
|
||||||
|
| sh -s -- -y --no-modify-path --profile minimal --default-toolchain none
|
||||||
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
fi
|
||||||
|
rustup show
|
||||||
|
rustup target add ${{ matrix.target }}
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
key: ${{ matrix.target }}
|
||||||
|
|
||||||
|
# ── build ─────────────────────────────────────────────────────────────
|
||||||
|
- name: Build kigi
|
||||||
|
shell: bash
|
||||||
|
run: cargo build --profile release-dist -p kigi-bin --locked --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
# ── package, upload, checksum ─────────────────────────────────────────
|
||||||
|
# Archives go straight to the release rather than through the artifact
|
||||||
|
# store: they are large, and the release is the only place install.sh
|
||||||
|
# can read them from anyway. Only the checksum line travels as an
|
||||||
|
# artifact, for the publish job to concatenate.
|
||||||
|
- name: Package (unix)
|
||||||
|
if: matrix.ext == 'tar.gz'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
version="${GITHUB_REF_NAME#v}"
|
||||||
|
archive="kigi-${version}-${{ matrix.target }}.tar.gz"
|
||||||
|
staging="$(mktemp -d)"
|
||||||
|
cp "target/${{ matrix.target }}/release-dist/kigi" "$staging/kigi"
|
||||||
|
cp LICENSE "$staging/"
|
||||||
|
[ -f NOTICE ] && cp NOTICE "$staging/"
|
||||||
|
for f in THIRD-PARTY-NOTICES THIRD-PARTY-NOTICES.md; do
|
||||||
|
[ -f "$f" ] && cp "$f" "$staging/"
|
||||||
|
done
|
||||||
|
tar -C "$staging" -czf "$archive" .
|
||||||
|
echo "ARCHIVE=$archive" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Package (windows)
|
||||||
|
if: matrix.ext == 'zip'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$version = $env:GITHUB_REF_NAME.TrimStart("v")
|
||||||
|
$archive = "kigi-$version-${{ matrix.target }}.zip"
|
||||||
|
$staging = Join-Path $env:RUNNER_TEMP "staging"
|
||||||
|
if (Test-Path $staging) { Remove-Item $staging -Recurse -Force }
|
||||||
|
New-Item -ItemType Directory -Force -Path $staging | Out-Null
|
||||||
|
Copy-Item "target/${{ matrix.target }}/release-dist/kigi.exe" (Join-Path $staging "kigi.exe")
|
||||||
|
Copy-Item LICENSE $staging
|
||||||
|
if (Test-Path NOTICE) { Copy-Item NOTICE $staging }
|
||||||
|
foreach ($f in @("THIRD-PARTY-NOTICES", "THIRD-PARTY-NOTICES.md")) {
|
||||||
|
if (Test-Path $f) { Copy-Item $f $staging }
|
||||||
|
}
|
||||||
|
Compress-Archive -Path (Join-Path $staging "*") -DestinationPath $archive -Force
|
||||||
|
Add-Content -Path $env:GITHUB_ENV -Value "ARCHIVE=$archive"
|
||||||
|
|
||||||
|
# Git Bash on Windows; sha256sum is available on every runner except
|
||||||
|
# macOS, which has shasum.
|
||||||
|
- name: Upload and checksum
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
gh release upload "$GITHUB_REF_NAME" "$ARCHIVE" --clobber
|
||||||
|
echo "Uploaded $ARCHIVE"
|
||||||
|
if command -v sha256sum >/dev/null; then
|
||||||
|
sha256sum "$ARCHIVE" > "checksum-${{ matrix.target }}.txt"
|
||||||
|
else
|
||||||
|
shasum -a 256 "$ARCHIVE" > "checksum-${{ matrix.target }}.txt"
|
||||||
|
fi
|
||||||
|
cat "checksum-${{ matrix.target }}.txt"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: checksum-${{ matrix.target }}
|
||||||
|
path: checksum-${{ matrix.target }}.txt
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: publish release
|
||||||
|
needs: [prepare, build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: checksums
|
||||||
|
pattern: checksum-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Assemble SHA256SUMS
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
# Strip CR (Git Bash may emit CRLF) and the binary-mode `*` marker
|
||||||
|
# so every line is `<hash> <name>` for install.sh.
|
||||||
|
cat checksums/checksum-*.txt \
|
||||||
|
| tr -d '\r' | sed 's/ \*/ /' | grep -v '^$' | sort -k2 > SHA256SUMS
|
||||||
|
lines="$(wc -l < SHA256SUMS)"
|
||||||
|
if [ "$lines" -ne 5 ]; then
|
||||||
|
echo "expected 5 checksum lines, got $lines" >&2
|
||||||
|
cat SHA256SUMS >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cat SHA256SUMS
|
||||||
|
|
||||||
|
# Flip the draft public only now that every asset install.sh looks for
|
||||||
|
# is attached.
|
||||||
|
- name: Attach SHA256SUMS and publish
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
gh release upload "$GITHUB_REF_NAME" SHA256SUMS --clobber
|
||||||
|
gh release edit "$GITHUB_REF_NAME" --draft=false
|
||||||
|
echo "Published $GITHUB_REF_NAME"
|
||||||
+36
-126
@@ -1,13 +1,11 @@
|
|||||||
# Release checklist (PRD F8)
|
# Release checklist (PRD F8)
|
||||||
|
|
||||||
Kigi ships as a single-file binary for five targets, published on this
|
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
|
repo's GitHub Releases
|
||||||
`install.sh` / `install.ps1` and stay current through the in-app
|
(<https://github.com/ELY-Open-Source/Kigi-CLI/releases>) by
|
||||||
self-updater (`kigi-update`), which resolves the same Releases API.
|
`.github/workflows/release.yml`. Users install via `install.sh` /
|
||||||
|
`install.ps1` and stay current through the in-app self-updater
|
||||||
`.github/workflows/release.yml` is the retired GitHub pipeline. Gitea ignores
|
(`kigi-update`), which resolves the same Releases API.
|
||||||
`.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.
|
|
||||||
|
|
||||||
## Cutting a release
|
## 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
|
`release-dist` profile, packages
|
||||||
`kigi-<version>-<target-triple>.{tar.gz|zip}` archives (binary +
|
`kigi-<version>-<target-triple>.{tar.gz|zip}` archives (binary +
|
||||||
LICENSE + NOTICE + THIRD-PARTY-NOTICES), generates `SHA256SUMS`, and
|
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`
|
`v0.2.0-alpha.1`) publish as pre-releases, which only the `alpha`
|
||||||
update channel picks up.
|
update channel picks up.
|
||||||
|
|
||||||
The release is created as a **draft** and only flipped public once
|
The release is created as a **draft** and only flipped public once
|
||||||
`SHA256SUMS` is attached, so `releases/latest` never hands the installer
|
`SHA256SUMS` is attached, so `releases/latest` never hands the installer
|
||||||
a release whose checksum manifest is still missing. A failed run leaves
|
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
|
the draft in place; re-running the workflow reuses it rather than
|
||||||
a duplicate `tag_name`.
|
erroring on a duplicate `tag_name`.
|
||||||
5. Smoke-test an installed artifact:
|
5. Smoke-test an installed artifact:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -52,127 +50,39 @@ does not run — it is kept only as a reference for the GitHub-hosted layout.
|
|||||||
|
|
||||||
## Build runners
|
## Build runners
|
||||||
|
|
||||||
Gitea has no hosted runners, so all three `runs-on` labels below are machines
|
Every leg runs on a GitHub-hosted runner; none needs local state, so no
|
||||||
we register ourselves with `gitea-runner` (the binary formerly called
|
self-hosted runner is involved. The repo is public, so keep it that way: a
|
||||||
`act_runner`). Labels are declared in the runner's `config.yaml` as
|
self-hosted runner must never be reachable from a `pull_request` event, and
|
||||||
`<label>:host` (run directly on the machine) or `<label>:docker://<image>` (run
|
this workflow only triggers on tag pushes.
|
||||||
in a container) — with `gitea-runner` v2, `register --labels` is ignored
|
|
||||||
whenever a config file supplies them.
|
|
||||||
|
|
||||||
| Label | Machine | Mode | Builds |
|
| Runner | Builds |
|
||||||
| ---------------- | ------------------------------ | ------ | -------------------------------------------------- |
|
| ------------------ | ------------------------------------------------------- |
|
||||||
| `ubuntu-latest` | the Linux server | docker | `x86_64-unknown-linux-gnu`, `aarch64-unknown-linux-gnu` |
|
| `ubuntu-latest` | `x86_64-unknown-linux-gnu` |
|
||||||
| `macos-arm64` | Mac Mini (M4) | host | `aarch64-apple-darwin`, `x86_64-apple-darwin` |
|
| `ubuntu-24.04-arm` | `aarch64-unknown-linux-gnu` (native, no cross toolchain) |
|
||||||
| `windows-amd64` | RaidenMei (Windows PC) | host | `x86_64-pc-windows-msvc` |
|
| `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
|
`macos-latest` is Apple Silicon; `x86_64-apple-darwin` is a cross-compile
|
||||||
runner already advertises. That image is a bare runner-image, so those legs
|
against the same SDK. The Darwin targets need the real Apple linker
|
||||||
provision their own apt packages and rustup per run (`rustup show` then picks
|
(`.cargo/config.toml` passes `-ObjC` and `-undefined dynamic_lookup`), so they
|
||||||
up the `rust-toolchain.toml` pin). If you register a dedicated
|
cannot move to a Linux runner.
|
||||||
`linux-x86_64:docker://…` runner later, change the three Linux `runs-on`
|
|
||||||
values back to match it.
|
|
||||||
|
|
||||||
**The Mac is not optional.** Apple's SDK licence limits macOS builds to
|
`windows-latest` ships the VS Build Tools the static MSVC CRT link needs
|
||||||
Apple-branded hardware, and the Darwin targets need the real Apple linker
|
(`ring`, `mimalloc`, `zstd-sys` and `libz-sys` build with
|
||||||
anyway (`.cargo/config.toml` passes `-ObjC` and `-undefined dynamic_lookup`).
|
`-C target-feature=+crt-static`). Every job installs protoc
|
||||||
There is no supported way to produce our macOS artifacts on the Linux server.
|
(`PROTOC_VERSION`, matching the `bin/protoc` dotslash pin) and runs
|
||||||
One Apple Silicon Mac covers both Darwin targets — `x86_64-apple-darwin` is a
|
`rustup show` to materialise the `rust-toolchain.toml` pin; the arm64 Linux
|
||||||
cross-compile against the same SDK, exactly as the old GitHub `macos-14`
|
leg installs rustup first if the image lacks it.
|
||||||
runner did it.
|
|
||||||
|
|
||||||
Windows is a softer requirement but still wants a real machine: the tree links
|
The release steps use the preinstalled `gh` CLI with `secrets.GITHUB_TOKEN`
|
||||||
`ring`, `mimalloc`, `zstd-sys` and `libz-sys` against a static MSVC CRT
|
(`permissions: contents: write`): `gh release create --draft`, then
|
||||||
(`-C target-feature=+crt-static`). Cross-compiling that from Linux with
|
`gh release upload` per target, then `SHA256SUMS` and
|
||||||
`cargo-xwin` is possible but means debugging four C builds under `clang-cl`;
|
`gh release edit --draft=false`. Only the five checksum lines travel through
|
||||||
a Windows runner with the VS 2022 C++ Build Tools reproduces today's binary
|
`actions/upload-artifact@v4`; the archives go straight to the release.
|
||||||
exactly.
|
|
||||||
|
|
||||||
Linux arm64 *is* cross-compiled on the x86_64 box — the workflow installs
|
Build caches come from `Swatinem/rust-cache`. GitHub only lets a tag run
|
||||||
`gcc-aarch64-linux-gnu` and points `cc-rs` at it. The one thing this loses is
|
restore caches made on its own ref or the default branch, and nothing builds
|
||||||
the ability to smoke-test the arm64 binary before publishing (the old GitHub
|
on `main`, so a tag build starts cold; the cache helps re-runs of the same tag.
|
||||||
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.
|
|
||||||
|
|
||||||
## Invariants to keep in lockstep
|
## Invariants to keep in lockstep
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user