mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-26 00:29:06 +02:00
Goreleaser's RPM build is split into one nfpm entry per architecture, each pinned to a single-arch build, with the version substituted from the release job. The deb package, archives, and container images are unaffected. Also fixes rpmlint: incoherent-version-in-changelog, found while investigating: nfpm writes the changelog title straight from semver and never appends the release, so entries read 0.79.0 against a 0.79.0-1 package.
47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Write .goreleaser.generated.yaml with the @RPM_EVR@ placeholder filled in.
|
|
#
|
|
# Red Hat certification (RPM Version Handling) expects rpmbuild's ISA provide,
|
|
# netbird(x86-64) = <evr>. nfpm does not emit it and GoReleaser does not template
|
|
# the provides field, so the version is substituted before GoReleaser runs.
|
|
#
|
|
# The value has to match what nfpm derives from the same tag: a semver
|
|
# prerelease becomes a tilde suffix, and the release defaults to 1.
|
|
|
|
set -eu
|
|
|
|
OUT=.goreleaser.generated.yaml
|
|
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
case "$TAG" in
|
|
v*) ;;
|
|
*) TAG=$(git describe --tags --abbrev=0) ;;
|
|
esac
|
|
|
|
EVR=$(python3 - "$TAG" <<'PYEOF'
|
|
import sys
|
|
|
|
version = sys.argv[1].lstrip("v")
|
|
version, _, metadata = version.partition("+")
|
|
core, _, prerelease = version.partition("-")
|
|
if prerelease:
|
|
core += "~" + prerelease.replace("-", "_")
|
|
if metadata:
|
|
core += "+" + metadata
|
|
print("{}-1".format(core))
|
|
PYEOF
|
|
)
|
|
|
|
# Written to a separate, ignored file: GoReleaser refuses to release from a
|
|
# dirty tree, so .goreleaser.yaml itself must stay untouched.
|
|
sed "s/@RPM_EVR@/${EVR}/g" .goreleaser.yaml > "$OUT"
|
|
|
|
# A surviving placeholder means the provides entries moved or were renamed.
|
|
if grep -n "@RPM_EVR@" "$OUT"; then
|
|
echo "unsubstituted @RPM_EVR@ left in $OUT" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "rpm provides version: ${EVR} -> ${OUT}"
|