Files
ClaudeandClaude Opus 5 7daceac077 Drop the version from release artifact names
The install scripts fetch deployr_<os>_<arch>, and the release tag already says
which version it is. Keeping the version in the filename too meant the bootstrap
had to reconstruct the name from the tag, which breaks the moment a tag is not
exactly "v" plus the version string.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 17:20:58 -05:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Cross-compiles deployr for every supported platform.
#
# ./scripts/build.sh # build everything into dist/
# VERSION=1.0.0 ./scripts/build.sh # stamp a release version
# TARGETS="linux/amd64" ./scripts/build.sh
set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="${VERSION:-dev}"
OUTDIR="${OUTDIR:-dist}"
TARGETS="${TARGETS:-windows/amd64 windows/arm64 darwin/amd64 darwin/arm64 linux/amd64 linux/arm64}"
COMMIT="$(git rev-parse --short HEAD 2>/dev/null || echo none)"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
PKG="git.starwarslab.us/ATOM_IT/Deployr/internal/version"
LDFLAGS="-s -w -X ${PKG}.Version=${VERSION} -X ${PKG}.Commit=${COMMIT} -X ${PKG}.Date=${DATE}"
mkdir -p "$OUTDIR"
for target in $TARGETS; do
os="${target%%/*}"
arch="${target##*/}"
name="deployr_${os}_${arch}"
[ "$os" = "windows" ] && name="${name}.exe"
echo "building ${target} -> ${OUTDIR}/${name}"
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" \
go build -trimpath -ldflags "$LDFLAGS" -o "${OUTDIR}/${name}" ./cmd/deployr
done
( cd "$OUTDIR" && rm -f SHA256SUMS && sha256sum ./* > SHA256SUMS 2>/dev/null || shasum -a 256 ./* > SHA256SUMS )
echo
ls -lh "$OUTDIR"