All checks were successful
android-ci / android (pull_request) Successful in 12m20s
README, android/README, VERIFY and the two release scripts all named v0.14.0, a version that was never tagged or released - the newest tag is v0.4.0, so the documented download URLs were dead. Align them with the version this release cuts (minor bump off v0.4.0 -> v0.5.0). VERIFY.md gains a Check 0: /releases/latest/download/... is not served by this Forgejo (404, pin the tag), and Cloudflare answers a non-browser User-Agent with 403 error code 1010 even on a correct URL (measured: browser 206, curl 206, Python-urllib 403).
80 lines
No EOL
2.9 KiB
Shell
Executable file
80 lines
No EOL
2.9 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Offline fallback: build and publish the x86_64 release asset from this host
|
|
# when CI (.forgejo/workflows/release.yml) cannot be used.
|
|
#
|
|
# Usage: MINISIGN_SECRET_KEY=... FORGEJO_TOKEN=... scripts/build-release-local.sh v0.5.0
|
|
#
|
|
# It runs the SAME recipe CI runs, inside the same digest-pinned builder image,
|
|
# so the asset it publishes is one a verifier can reproduce. A plain host
|
|
# `cargo build` would not be: different rustc, different build paths, different
|
|
# bytes — and the published hash would then match nothing anyone could rebuild,
|
|
# which is worse than having no fallback at all.
|
|
#
|
|
# 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"
|
|
|
|
# Must equal RUST_IMAGE in .forgejo/workflows/release.yml and BUILDER_IMAGE in
|
|
# scripts/verify-reproducible.sh. Three copies, one digest — see docs/VERIFY.md.
|
|
BUILDER_IMAGE="rust@sha256:93ce27a88655056a51dbdd8f5f2d7ddc071c7b0070fb288a37b5a285fc83971e"
|
|
|
|
command -v docker >/dev/null 2>&1 || {
|
|
echo "build-release-local: docker is required (the build runs in the pinned image)" >&2
|
|
exit 1
|
|
}
|
|
|
|
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
|
|
|
|
sha="$(git rev-parse --verify "$tag^{commit}" 2>/dev/null)" || {
|
|
echo "build-release-local: tag $tag not found — run: git fetch --tags" >&2
|
|
exit 1
|
|
}
|
|
sde="$(git log -1 --format=%ct "$sha")"
|
|
echo "==> $tag at $sha, SOURCE_DATE_EPOCH=$sde"
|
|
|
|
work="$(mktemp -d)"
|
|
trap 'rm -rf "$work"' EXIT
|
|
mkdir -p "$work/src" "$work/out" "$work/target"
|
|
git archive "$sha" | tar -x -C "$work/src"
|
|
|
|
docker volume create onionwire-local-registry >/dev/null
|
|
docker run --rm \
|
|
-v "$work/src:/src:ro" \
|
|
-v onionwire-local-registry:/usr/local/cargo/registry \
|
|
-v "$work/target:/target" \
|
|
-v "$work/out:/out" \
|
|
-e SOURCE_DATE_EPOCH="$sde" \
|
|
-e BUILDER_IMAGE="$BUILDER_IMAGE" \
|
|
-e TARGET_TRIPLE="$target" \
|
|
-e GIT_SHA="$sha" \
|
|
-w /src \
|
|
"$BUILDER_IMAGE" \
|
|
bash scripts/reproducible-build.sh
|
|
|
|
mkdir -p dist
|
|
cp "$work/out/onionwire-$target" \
|
|
"$work/out/onionwire-$target.sha256" \
|
|
"$work/out/build-info-$target.txt" \
|
|
dist/
|
|
file "dist/onionwire-$target"
|
|
"dist/onionwire-$target" --version
|
|
|
|
echo "==> signing (needs minisign on PATH and the committed public key)"
|
|
RELEASE_TAG="$tag" scripts/sign-release.sh \
|
|
"dist/onionwire-$target" "dist/onionwire-$target.sha256"
|
|
|
|
echo "==> publishing to the release for $tag"
|
|
scripts/publish-release.sh "$tag" "OnionWire $tag" scripts/release-body.md \
|
|
"dist/onionwire-$target" \
|
|
"dist/onionwire-$target.sha256" \
|
|
"dist/onionwire-$target.minisig" \
|
|
"dist/onionwire-$target.sha256.minisig" \
|
|
"dist/build-info-$target.txt" |