From d1d0889eb31780c7bd3b22b7c739d451aece4036 Mon Sep 17 00:00:00 2001 From: Hein Date: Mon, 12 Oct 2026 20:57:37 +0200 Subject: [PATCH] build: bump Gentoo and Void versions in release-version Move version bumping into scripts/bump-version.sh, rename the ebuild per release, reset the Void checksum, and add make pkg-checksums to fill it after the release. --- Makefile | 14 ++++++++------ scripts/bump-version.sh | 23 +++++++++++++++++++++++ scripts/update-checksums.sh | 13 +++++++++++++ 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100755 scripts/bump-version.sh create mode 100755 scripts/update-checksums.sh diff --git a/Makefile b/Makefile index ef96798..38fa3cb 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CONFIG_DIR := /etc/unitdore VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") LDFLAGS := -ldflags "-X github.com/warkanum/unitdore/cmd.version=$(VERSION)" -.PHONY: all build install uninstall test lint clean release-version +.PHONY: all build install uninstall test lint clean release-version pkg-checksums all: build @@ -42,7 +42,7 @@ lint: clean: rm -f $(BINARY) -## release-version: bump patch version, update source versions, commit, tag, and push +## release-version: bump patch version, update source and package versions, commit, tag, and push release-version: @CURRENT=$$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"); \ MAJOR=$$(echo $$CURRENT | sed 's/v\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'); \ @@ -51,15 +51,17 @@ release-version: NEXT="v$$MAJOR.$$MINOR.$$((PATCH + 1))"; \ PKGVER="$$MAJOR.$$MINOR.$$((PATCH + 1))"; \ echo "Current: $$CURRENT → Next: $$NEXT"; \ - sed -i "s/^var version = .*/var version = \"$$PKGVER\"/" cmd/root.go; \ - sed -i "s/^pkgver=.*/pkgver=$$PKGVER/" pkg/arch/PKGBUILD; \ - sed -i "s/^Version:.*/Version: $$PKGVER/" pkg/centos/unitdore.spec; \ - git add cmd/root.go pkg/arch/PKGBUILD pkg/centos/unitdore.spec; \ + scripts/bump-version.sh "$$PKGVER"; \ + git add -A cmd/root.go pkg; \ git commit -m "chore(release): update package version to $$PKGVER"; \ git tag -a "$$NEXT" -m "Release $$NEXT"; \ git push origin HEAD "$$NEXT"; \ echo "Pushed $$NEXT — release workflow triggered" +## pkg-checksums: fill the Void checksum from the published release (run after release) +pkg-checksums: + scripts/update-checksums.sh + ## help: show this help help: @grep -E '^## ' Makefile | sed 's/## / /' diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh new file mode 100755 index 0000000..3daff17 --- /dev/null +++ b/scripts/bump-version.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Usage: scripts/bump-version.sh X.Y.Z +# Updates the version in source and every package definition. +# Run from the repo root. Void checksum is reset: fill it with +# scripts/update-checksums.sh once the release tarball exists. +set -eu + +VER="${1:?usage: $0 X.Y.Z}" +EBUILD_DIR=pkg/gentoo/app-containers/unitdore + +sed -i "s/^var version = .*/var version = \"$VER\"/" cmd/root.go +sed -i "s/^pkgver=.*/pkgver=$VER/" pkg/arch/PKGBUILD +sed -i "s/^Version:.*/Version: $VER/" pkg/centos/unitdore.spec + +# Gentoo: the version lives in the ebuild file name +OLD_EBUILD=$(ls "$EBUILD_DIR"/unitdore-*.ebuild | head -n1) +NEW_EBUILD="$EBUILD_DIR/unitdore-$VER.ebuild" +[ "$OLD_EBUILD" = "$NEW_EBUILD" ] || git mv "$OLD_EBUILD" "$NEW_EBUILD" + +# Void: version bump invalidates the checksum +sed -i -e "s/^version=.*/version=$VER/" \ + -e "s/^revision=.*/revision=1/" \ + -e "s/^checksum=.*/checksum=UPDATE_AFTER_RELEASE/" pkg/void/srcpkgs/unitdore/template diff --git a/scripts/update-checksums.sh b/scripts/update-checksums.sh new file mode 100755 index 0000000..95829a4 --- /dev/null +++ b/scripts/update-checksums.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Usage: scripts/update-checksums.sh +# Fills the Void template checksum from the published release source tarball. +# Run from the repo root after the release workflow has finished. +set -eu + +T=pkg/void/srcpkgs/unitdore/template +VER=$(sed -n 's/^version=//p' "$T") +URL="https://git.warky.dev/wdevs/unitdore/releases/download/v$VER/unitdore-v$VER-source.tar.gz" + +SUM=$(curl -fsSL "$URL" | sha256sum | cut -d' ' -f1) +sed -i "s/^checksum=.*/checksum=$SUM/" "$T" +echo "void checksum for v$VER: $SUM"