Some checks failed
ci / test (pull_request) Failing after 2m16s
Drop the tag-push trigger so API-created tags cannot start a second run. Core paths on main (or workflow_dispatch) mint the next v*.*.* tag (v0.1.0 when none exist), build both arches in CI, and publish one release. dry_run builds without tagging. Fail closed on empty assets.
36 lines
1.3 KiB
Shell
Executable file
36 lines
1.3 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Offline fallback: build the x86_64 release asset on this host and publish it
|
|
# to the Forgejo release for <tag>. CI (.forgejo/workflows/release.yml) now
|
|
# builds both aarch64 (Pi runner) and x86_64 (amd64 runner). Use this script
|
|
# when you cannot wait for CI or the amd64 runner is down.
|
|
#
|
|
# Usage: FORGEJO_TOKEN=... scripts/build-release-local.sh v0.1.0
|
|
#
|
|
# Does not create or push the tag: the release workflow owns tagging. Idempotent
|
|
# (same-named assets are replaced). Never moves an existing tag.
|
|
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"
|