Files
inbuxa-cli/scripts/build-release.sh
T
jcoffey-dev 586bf6d09d
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 7m54s
ci / announce (pull_request) Skipped
inbuxa-cli: the registry from the command line, and plans
List, get, create, update and delete any registry type the server's schema
describes, naming objects by id or by key. snapshot writes the settings as
a plan with references by key; apply makes a server match one, in reference
order, changing only what the plan names. Settings are reloaded after a
change where the server didn't do it itself.

CI and releases follow inbuxa-migrate: Gitea waits on GitHub's build, and
v* tags publish Linux amd64 and arm64 archives with SHA256SUMS.
2026-10-26 07:24:34 -07:00

46 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: AGPL-3.0-only
#
# Build one release archive for the machine this runs on.
#
# Usage: scripts/build-release.sh VERSION OUTDIR
# scripts/build-release.sh v2026.9.30 dist
#
# CI runs exactly this on one native runner per architecture (amd64 and
# arm64) and joins the results with SHA256SUMS, so a release can be checked
# before tagging on any Linux machine with cargo. The archive name carries no
# version, so .../releases/latest/download/<name> always means the newest.
set -euo pipefail
VERSION="${1:?usage: $0 VERSION OUTDIR}"
OUT="${2:?usage: $0 VERSION OUTDIR}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
case "$(uname -m)" in
x86_64) arch=amd64 ;;
aarch64 | arm64) arch=arm64 ;;
*) echo "unsupported architecture: $(uname -m)" >&2; exit 1 ;;
esac
# The tag names the version the binary reports, so the two cannot disagree.
want="v$(cd "$ROOT" && cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
[ "$VERSION" = "$want" ] || { echo "tag $VERSION does not match Cargo.toml ($want)" >&2; exit 1; }
name="inbuxa-cli-linux-$arch"
mkdir -p "$OUT"
OUT="$(cd "$OUT" && pwd)"
STAGE="$(mktemp -d)"
trap 'rm -rf "$STAGE"' EXIT
echo "==> building $name ($VERSION)"
(cd "$ROOT" && cargo build --release --locked)
mkdir -p "$STAGE/$name"
cp "$ROOT/target/release/inbuxa-cli" "$ROOT/README.md" "$STAGE/$name/"
cp -r "$ROOT/LICENSES" "$STAGE/$name/"
# Fixed owner, order and time, so the archive's layout and metadata do not
# change from one build of a tag to the next.
tar --sort=name --owner=0 --group=0 --numeric-owner --mtime="@${SOURCE_DATE_EPOCH:-0}" \
-C "$STAGE/$name" -czf "$OUT/$name.tar.gz" inbuxa-cli LICENSES README.md
echo "==> $OUT/$name.tar.gz"