onionwire/scripts/build-release-local.sh
Sirius DevOps 91fd9601b8
Some checks failed
ci / test (push) Failing after 1m6s
ci: Forgejo-native ci + release workflows
The GitHub workflows could never run on this instance: jobs asked for
ubuntu-24.04 runners (the Pi runner only registers the 'docker' label, so
every job sat in waiting), and release.yml published to github.com, which
is not a remote of this repo.

- .forgejo/workflows/ci.yml  — cargo test + clippy on the 'docker' label,
  Rust work in a rust:1.87-bookworm sibling container (aarch64 native)
- .forgejo/workflows/release.yml — on v*.*.* tags, build aarch64, strip,
  sha256, publish to the Forgejo release; workflow_dispatch takes a tag
  to re-publish
- scripts/publish-release.sh — idempotent create-or-update release +
  asset upload via the Forgejo API (replaces same-named assets)
- scripts/build-release-local.sh — x86_64 path (no x86_64 runner exists)
- scripts/release-body.md — release notes template (@TAG@ substituted)
- README: install URLs -> Forgejo, accurate maintainer release procedure
- remove .github/workflows/*
2026-09-10 13:10:56 -04:00

35 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build the x86_64 release asset on this host and publish it to the Forgejo
# release for <tag>. CI (.forgejo/workflows/release.yml) only covers aarch64 —
# there is no x86_64 runner on the instance, so this is the x86_64 path.
#
# Usage: FORGEJO_TOKEN=... scripts/build-release-local.sh v0.1.2
#
# Does not create or push the tag: tag and push first, then run this so the
# release body/asset set matches a real tag. Idempotent (assets are replaced).
set -euo pipefail
tag="${1:?usage: build-release-local.sh <tag>}"
target=x86_64-unknown-linux-gnu
root="$(cd "$(dirname "$0")/.." && pwd)"
cd "$root"
expected="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
if [ "$tag" != "v$expected" ]; then
echo "warn: tag $tag does not match Cargo.toml version $expected (--version will report $expected)"
fi
echo "==> cargo build --release --locked"
cargo build --release --locked
mkdir -p dist
asset="onionwire-$target"
cp "target/release/onionwire" "dist/$asset"
strip "dist/$asset"
(cd dist && sha256sum "$asset" > "$asset.sha256" && sha256sum -c "$asset.sha256")
file "dist/$asset"
"dist/$asset" --version
echo "==> publishing to the release for $tag"
scripts/publish-release.sh "$tag" "OnionWire $tag" scripts/release-body.md \
"dist/$asset" "dist/$asset.sha256"