From 36d958f31fd143c61e327fc64d74e50376d7fcef Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Thu, 4 Jun 2026 16:45:41 -0500 Subject: [PATCH] refactor: pre-release uses CLI version_bump.php instead of inline shell math Delegates version bumping to moko-platform CLI tools: - version_bump.php (patch default, --minor for RC) - version_set_platform.php (stability suffix) - version_check.php (consistency) This keeps the workflow thin and the logic in the shared CLI. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- .mokogitea/workflows/pre-release.yml | 33 +++++++++------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.mokogitea/workflows/pre-release.yml b/.mokogitea/workflows/pre-release.yml index 7be67d50..95fc4c20 100644 --- a/.mokogitea/workflows/pre-release.yml +++ b/.mokogitea/workflows/pre-release.yml @@ -96,36 +96,23 @@ jobs: release-candidate) SUFFIX="-rc"; TAG="release-candidate" ;; esac - # Read current version (bump already handled by push workflow) - VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null) - [ -z "$VERSION" ] && VERSION="00.00.01" - - # Strip any existing suffix from version before applying stability - VERSION=$(echo "$VERSION" | sed 's/-\(dev\|alpha\|beta\|rc\)$//') - - # Dev/alpha/beta: bump patch so each build gets a unique version - # RC: consolidate to next minor (02.33.xx → 02.34.00) - MAJOR=$(echo "$VERSION" | cut -d. -f1) - MINOR=$(echo "$VERSION" | cut -d. -f2) - PATCH=$(echo "$VERSION" | cut -d. -f3) + # Bump version via CLI: patch for dev/alpha/beta, minor for RC case "$STABILITY" in - development|alpha|beta) - PATCH=$(printf "%02d" $((10#$PATCH + 1))) - VERSION="${MAJOR}.${MINOR}.${PATCH}" - ;; - release-candidate) - MINOR=$(printf "%02d" $((10#$MINOR + 1))) - VERSION="${MAJOR}.${MINOR}.00" - ;; + release-candidate) BUMP="minor" ;; + *) BUMP="patch" ;; esac + php ${MOKO_CLI}/version_bump.php --path . $([ "$BUMP" = "minor" ] && echo "--minor") 2>/dev/null || true + + # Set stability suffix and verify consistency + VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null || echo "00.00.01") + VERSION=$(echo "$VERSION" | sed 's/-\(dev\|alpha\|beta\|rc\)$//') + php ${MOKO_CLI}/version_set_platform.php \ --path . --version "$VERSION" --branch "${{ github.ref_name }}" --stability "$STABILITY" 2>/dev/null || true - - # Verify version consistency across all files php ${MOKO_CLI}/version_check.php --path . --fix 2>/dev/null || true - # Update VERSION variable with suffix + # Append suffix for output if [ -n "$SUFFIX" ]; then VERSION="${VERSION}${SUFFIX}" fi