#!/usr/bin/env bash # Build every release artifact into build/release// inside an Ubuntu 22.04 # container, so the bundled binaries need only glibc 2.35 or newer: # albedo--x86_64.AppImage, albedo__amd64.deb, # albedo--1.x86_64.rpm, albedo--1-x86_64.pkg.tar.zst # Downloads and the compiled OTP are cached in ~/.cache/albedo-release. # Usage: release/build.sh [version] (default: git describe; semver, no leading v) set -euo pipefail root="$(cd "$(dirname "$0")/.." && pwd)" version="${1:-$(git -C "$root" describe --tags --always --dirty 2>/dev/null | sed 's/^v//' || echo 0.0.0-dev)}" out="$root/build/release" cache="${ALBEDO_RELEASE_CACHE:-$HOME/.cache/albedo-release}" mkdir -p "$cache" && cache="$(cd "$cache" && pwd)" engine="${CONTAINER_ENGINE:-$(command -v podman || command -v docker)}" mkdir -p "$out" "$cache" # Ship what git would: tracked files plus untracked ones that are not ignored. scratch="$(mktemp -d)" trap 'rm -rf "$scratch"' EXIT git -C "$root" ls-files -z --cached --others --exclude-standard | tar -C "$root" --null -T - -cf "$scratch/src.tar" "$engine" run --rm \ -v "$scratch/src.tar:/work/src.tar:ro" \ -v "$root/release:/work/release:ro" \ -v "$cache:/cache" \ -v "$out:/out" \ -e ALBEDO_VERSION="$version" \ -e PACKAGE_MAINTAINER="${PACKAGE_MAINTAINER:-}" \ docker.io/library/ubuntu:22.04 bash /work/release/inside.sh ls -1 "$out/$version"