From 334bb15184ae98d8106c9e9b2c28159318a8ce49 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 30 May 2026 09:00:22 -0500 Subject: [PATCH 1/2] fix(cli): add dev alias to all stability maps in updates_xml_build The tool accepted 'development' but release_publish passes 'dev'. Added 'dev' as alias in suffixMap, tagMap, and releaseTagMap. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- cli/updates_xml_build.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/updates_xml_build.php b/cli/updates_xml_build.php index 60e7616..681f639 100644 --- a/cli/updates_xml_build.php +++ b/cli/updates_xml_build.php @@ -299,6 +299,7 @@ $stabilitySuffixMap = [ 'beta' => '-beta', 'alpha' => '-alpha', 'development' => '-dev', + 'dev' => '-dev', ]; // Joomla values — maps to Joomla's stabilityTagToInteger() @@ -308,6 +309,7 @@ $stabilityTagMap = [ 'beta' => 'beta', 'alpha' => 'alpha', 'development' => 'dev', + 'dev' => 'dev', ]; // Gitea release tag names (used in download/info URLs) @@ -317,6 +319,7 @@ $releaseTagMap = [ 'beta' => 'beta', 'alpha' => 'alpha', 'development' => 'development', + 'dev' => 'development', ]; // -- Build update entries ----------------------------------------------------- -- 2.52.0 From 2b5e394eec091c9e47c4e669d7b7067a8db79b35 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 30 May 2026 09:12:34 -0500 Subject: [PATCH 2/2] feat(cli): skip version bump when only non-code files change version_auto_bump now checks if files in the code directory (src/) changed in the last commit. If only docs/workflows/config changed, the bump is skipped entirely. Watch path auto-detected from manifest.xml tag, or can be passed explicitly via --watch-path. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- cli/version_auto_bump.php | 56 +++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/cli/version_auto_bump.php b/cli/version_auto_bump.php index f7de29e..350ba9a 100644 --- a/cli/version_auto_bump.php +++ b/cli/version_auto_bump.php @@ -26,11 +26,14 @@ $token = ''; $repoUrl = ''; $dryRun = false; +$watchPath = ''; + foreach ($argv as $i => $arg) { - if ($arg === '--path' && isset($argv[$i + 1])) $path = $argv[$i + 1]; - if ($arg === '--branch' && isset($argv[$i + 1])) $branch = $argv[$i + 1]; - if ($arg === '--token' && isset($argv[$i + 1])) $token = $argv[$i + 1]; - if ($arg === '--repo-url' && isset($argv[$i + 1])) $repoUrl = $argv[$i + 1]; + if ($arg === '--path' && isset($argv[$i + 1])) $path = $argv[$i + 1]; + if ($arg === '--branch' && isset($argv[$i + 1])) $branch = $argv[$i + 1]; + if ($arg === '--token' && isset($argv[$i + 1])) $token = $argv[$i + 1]; + if ($arg === '--repo-url' && isset($argv[$i + 1])) $repoUrl = $argv[$i + 1]; + if ($arg === '--watch-path' && isset($argv[$i + 1])) $watchPath = $argv[$i + 1]; if ($arg === '--dry-run') $dryRun = true; } @@ -62,17 +65,42 @@ if (array_key_exists($branch, $stabilityMap)) { $cli = __DIR__; $php = PHP_BINARY; -// Step 1: Patch bump — all branches get patch bumps -$shouldBump = true; - -if ($shouldBump) { - $bumpOutput = []; - exec("{$php} {$cli}/version_bump.php --path " . escapeshellarg($path) . " 2>&1", $bumpOutput, $bumpRc); - foreach ($bumpOutput as $line) { - echo "{$line}\n"; +// Auto-detect watch path from manifest.xml if not provided +if (empty($watchPath)) { + $manifestFile = realpath($path) . '/.mokogitea/manifest.xml'; + if (file_exists($manifestFile)) { + $xml = @simplexml_load_file($manifestFile); + if ($xml && isset($xml->build->{'entry-point'})) { + $watchPath = (string) $xml->build->{'entry-point'}; + } } -} else { - echo "Skipping patch bump on {$branch} branch (suffix change only)\n"; +} + +// Check if code files actually changed (skip bump for docs/config-only changes) +$shouldBump = true; +if (!empty($watchPath)) { + $root = realpath($path) ?: $path; + $diffOutput = trim((string) @shell_exec( + "cd " . escapeshellarg($root) . " && git diff --name-only HEAD~1 HEAD -- " . escapeshellarg($watchPath) . " 2>/dev/null" + )); + if (empty($diffOutput)) { + echo "No changes in {$watchPath} — skipping version bump\n"; + $shouldBump = false; + } else { + echo "Changes detected in {$watchPath}:\n{$diffOutput}\n"; + } +} + +if (!$shouldBump) { + echo "No code changes — nothing to do\n"; + exit(0); +} + +// Step 1: Patch bump +$bumpOutput = []; +exec("{$php} {$cli}/version_bump.php --path " . escapeshellarg($path) . " 2>&1", $bumpOutput, $bumpRc); +foreach ($bumpOutput as $line) { + echo "{$line}\n"; } // Step 2: Read version -- 2.52.0