solstice-ci/.mise/tasks/pkg/build

27 lines
985 B
Text
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
# Build Arch packages for Solstice CI components.
# Requires: Arch Linux with base-devel, rust, cargo, makepkg.
# Outputs: pkg files under packaging/arch/*/*.pkg.tar.*
ROOT_DIR=$(cd "$(dirname "$0")/../../../" && pwd)
cd "$ROOT_DIR"
# Create a clean source tarball of the repository
TARBALL="solstice-ci.tar.gz"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
# Create a tarball with a top-level solstice-ci/ prefix so PKGBUILDs can `cd "$srcdir/solstice-ci"`
# Use git archive to ensure only tracked files are included and the prefix is present.
git archive --format=tar.gz --prefix=solstice-ci/ -o "$TMPDIR/$TARBALL" HEAD
for pkg in solstice-orchestrator solstice-forge-integration; do
PKG_DIR="$ROOT_DIR/packaging/arch/$pkg"
mkdir -p "$PKG_DIR"
cp "$TMPDIR/$TARBALL" "$PKG_DIR/$TARBALL"
( cd "$PKG_DIR" && makepkg -fC --noconfirm )
echo "Built package(s) in $PKG_DIR:" >&2
ls -1 "$PKG_DIR"/*.pkg.tar.* 2>/dev/null || true
done