From 7fa3ff9c91523d367dfe6dadd9837fe06ab55a4f Mon Sep 17 00:00:00 2001 From: Kevin Adams Date: Sat, 16 May 2026 00:13:28 -0400 Subject: [PATCH] Add \$VERSION to FreeNAS.pm; use it as authoritative version in CI our \$VERSION = '2.3.0' is now the single source of truth for the release series. The build.yml extracts it with a perl one-liner (no module load, no stubs needed) and uses it as BASE_VERSION for alpha/beta channel builds. Git tags remain the release trigger: pushing an exact vX.Y.Z tag publishes to the stable Cloudsmith channel. A mismatch warning fires if the tag version and \$VERSION disagree, catching forgotten version bumps. The v2.3.0-pre anchor tag approach is superseded by this; the anchor tag can stay in history as a breadcrumb but \$VERSION is now what drives builds. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yml | 12 +++++++----- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e9d8b2..3b42fee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,11 +111,10 @@ jobs: REF="${{ github.ref }}" IS_RELEASE="false" - # Base version: nearest ancestor v* tag, stripping the 'v' prefix and any - # pre-release suffix (e.g. v2.3.0-pre → 2.3.0). This lets us use anchor - # tags like v2.3.0-pre to set the version series without triggering a release. - BASE_VERSION="$(git describe --tags --match 'v*' --abbrev=0 2>/dev/null \ - | sed 's/^v//' | sed 's/[^0-9.].*$//' || echo '0.0.0')" + # Base version from our $VERSION in FreeNAS.pm — the single source of truth. + # Bump that variable when starting a new release series; git tags trigger publishing. + BASE_VERSION="$(perl -ne 'if (/our\s+\$VERSION\s*=\s*['"'"'"]([^'"'"'"]+)/) { print $1; exit }' \ + perl5/PVE/Storage/LunCmd/FreeNAS.pm 2>/dev/null || echo '0.0.0')" # Only an exact vX.Y.Z tag (no suffix) is a stable release. if [[ "$REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then @@ -123,6 +122,9 @@ jobs: CHANNEL="stable" CLOUDSMITH_REPO="truenas-proxmox" IS_RELEASE="true" + if [[ "$VERSION" != "$BASE_VERSION" ]]; then + echo "::warning::Tag version ($VERSION) does not match \$VERSION in FreeNAS.pm ($BASE_VERSION)" + fi elif [[ "$REF" == refs/heads/master ]]; then VERSION="${BASE_VERSION}-beta+${SHORT_SHA}" diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 6548afa..04b6c78 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -1,5 +1,7 @@ package PVE::Storage::LunCmd::FreeNAS; +our $VERSION = '2.3.0'; + use strict; use warnings; use Data::Dumper;