diff --git a/.mokogitea/manifest.xml b/.mokogitea/manifest.xml index 4a2beb4..b3c0439 100644 --- a/.mokogitea/manifest.xml +++ b/.mokogitea/manifest.xml @@ -12,7 +12,7 @@ moko-platform MokoConsulting Enterprise automation, validation, sync, and governance engine for all Moko Consulting repositories - 09.01.00 + 09.02.05 GNU General Public License v3 diff --git a/.mokogitea/workflows/pre-release.yml b/.mokogitea/workflows/pre-release.yml index f0b1d88..4d8affb 100644 --- a/.mokogitea/workflows/pre-release.yml +++ b/.mokogitea/workflows/pre-release.yml @@ -76,14 +76,15 @@ jobs: run: | STABILITY="${{ inputs.stability || 'development' }}" + # Map stability to Gitea release tag case "$STABILITY" in - development) SUFFIX="-dev"; TAG="development" ;; - alpha) SUFFIX="-alpha"; TAG="alpha" ;; - beta) SUFFIX="-beta"; TAG="beta" ;; - release-candidate) SUFFIX="-rc"; TAG="release-candidate" ;; + development) TAG="development" ;; + alpha) TAG="alpha" ;; + beta) TAG="beta" ;; + release-candidate) TAG="release-candidate" ;; esac - # Read current version (bump already handled by push workflow) + # Read current version (includes suffix from manifest, e.g. 01.02.14-dev) VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null) [ -z "$VERSION" ] && VERSION="00.00.01" @@ -112,16 +113,15 @@ jobs: EXT_ELEMENT=$(grep '^ext_element=' "$GITHUB_OUTPUT" | tail -1 | cut -d= -f2) ZIP_NAME=$(grep '^zip_name=' "$GITHUB_OUTPUT" | tail -1 | cut -d= -f2) [ -z "$EXT_ELEMENT" ] && EXT_ELEMENT=$(echo "${GITEA_REPO}" | tr '[:upper:]' '[:lower:]' | tr -d ' -') - [ -z "$ZIP_NAME" ] && ZIP_NAME="${EXT_ELEMENT}-${VERSION}${SUFFIX}.zip" + [ -z "$ZIP_NAME" ] && ZIP_NAME="${EXT_ELEMENT}-${VERSION}.zip" echo "version=${VERSION}" >> "$GITHUB_OUTPUT" echo "stability=${STABILITY}" >> "$GITHUB_OUTPUT" - echo "suffix=${SUFFIX}" >> "$GITHUB_OUTPUT" echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "zip_name=${ZIP_NAME}" >> "$GITHUB_OUTPUT" echo "ext_element=${EXT_ELEMENT}" >> "$GITHUB_OUTPUT" - echo "=== Pre-Release: ${EXT_ELEMENT} ${VERSION}${SUFFIX} ===" + echo "=== Pre-Release: ${EXT_ELEMENT} ${VERSION} ===" - name: Create release id: release diff --git a/.mokogitea/workflows/update-server.yml b/.mokogitea/workflows/update-server.yml index 23cd2b5..b011f1b 100644 --- a/.mokogitea/workflows/update-server.yml +++ b/.mokogitea/workflows/update-server.yml @@ -182,14 +182,8 @@ jobs: PHP_TAG="" [ -n "$PHP_MINIMUM" ] && PHP_TAG="${PHP_MINIMUM}" - # Version suffix for non-stable - DISPLAY_VERSION="$VERSION" - case "$STABILITY" in - development) DISPLAY_VERSION="${VERSION}-dev" ;; - alpha) DISPLAY_VERSION="${VERSION}-alpha" ;; - beta) DISPLAY_VERSION="${VERSION}-beta" ;; - rc) DISPLAY_VERSION="${VERSION}-rc" ;; - esac + # VERSION already includes suffix from manifest (e.g. 01.02.14-dev) + # No separate DISPLAY_VERSION needed MAJOR=$(echo "$VERSION" | awk -F. '{print $1}') @@ -202,7 +196,7 @@ jobs: *) RELEASE_TAG="v${MAJOR}" ;; esac - PACKAGE_NAME="${EXT_ELEMENT}-${DISPLAY_VERSION}.zip" + PACKAGE_NAME="${EXT_ELEMENT}-${VERSION}.zip" DOWNLOAD_URL="${GITEA_URL}/${GITEA_ORG}/${GITEA_REPO}/releases/download/${RELEASE_TAG}/${PACKAGE_NAME}" INFO_URL="${GITEA_URL}/${GITEA_ORG}/${GITEA_REPO}" @@ -211,7 +205,7 @@ jobs: [ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs" if [ -d "$SOURCE_DIR" ]; then EXCLUDES=".ftpignore sftp-config* *.ppk *.pem *.key .env*" - TAR_NAME="${EXT_ELEMENT}-${DISPLAY_VERSION}.tar.gz" + TAR_NAME="${EXT_ELEMENT}-${VERSION}.tar.gz" cd "$SOURCE_DIR" zip -r "/tmp/${PACKAGE_NAME}" . -x $EXCLUDES @@ -234,7 +228,7 @@ jobs: "${API_BASE}/releases" \ -d "$(python3 -c "import json; print(json.dumps({ 'tag_name': '${RELEASE_TAG}', - 'name': '${RELEASE_TAG} (${DISPLAY_VERSION})', + 'name': '${RELEASE_TAG} (${VERSION})', 'body': '${STABILITY} release', 'prerelease': True, 'target_commitish': 'main' @@ -371,7 +365,7 @@ jobs: git config --local user.name "gitea-actions[bot]" git add updates.xml git diff --cached --quiet || { - git commit -m "chore: update updates.xml (${STABILITY}: ${DISPLAY_VERSION}) [skip ci]" \ + git commit -m "chore: update updates.xml (${STABILITY}: ${VERSION}) [skip ci]" \ --author="gitea-actions[bot] " git push } @@ -600,6 +594,6 @@ jobs: echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY echo "| Stability | \`${STABILITY}\` |" >> $GITHUB_STEP_SUMMARY - echo "| Version | \`${DISPLAY_VERSION}\` |" >> $GITHUB_STEP_SUMMARY + echo "| Version | \`${VERSION}\` |" >> $GITHUB_STEP_SUMMARY echo "| Element | \`${EXT_ELEMENT}\` |" >> $GITHUB_STEP_SUMMARY echo "| Download | [ZIP](${DOWNLOAD_URL}) |" >> $GITHUB_STEP_SUMMARY diff --git a/README.md b/README.md index d6e4565..3ed44e2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ DEFGROUP: MokoStandards.Root INGROUP: MokoStandards REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform PATH: /README.md -VERSION: 09.02.04 +VERSION: 09.02.05 BRIEF: Project overview and documentation --> diff --git a/cli/version_bump.php b/cli/version_bump.php index f2ba7c3..052bbcb 100644 --- a/cli/version_bump.php +++ b/cli/version_bump.php @@ -26,12 +26,14 @@ $root = realpath($path) ?: $path; // -- 1. Read version from .mokogitea/manifest.xml (canonical) -- $mokoVersion = null; +$mokoSuffix = ''; $mokoManifest = "{$root}/.mokogitea/manifest.xml"; $mokoContent = ''; if (file_exists($mokoManifest)) { $mokoContent = file_get_contents($mokoManifest); - if (preg_match('|(\d{2}\.\d{2}\.\d{2})|', $mokoContent, $m)) { + if (preg_match('|(\d{2}\.\d{2}\.\d{2})(?:-([a-z]+))?|', $mokoContent, $m)) { $mokoVersion = $m[1]; + $mokoSuffix = isset($m[2]) ? $m[2] : ''; } } @@ -66,8 +68,8 @@ foreach ($manifestFiles as $xmlFile) { $candidate = $xm[1]; if ($manifestVersion === null || version_compare($candidate, $manifestVersion, '>')) { $manifestVersion = $candidate; - // Preserve the suffix from the manifest (e.g. -dev, -rc) - $manifestSuffix = $xm[2] ?? ''; + // Preserve the suffix from the manifest (e.g. dev, rc) — strip leading dash + $manifestSuffix = ltrim($xm[2] ?? '', '-'); } } } @@ -109,16 +111,15 @@ switch ($type) { $new = sprintf('%02d.%02d.%02d', $major, $minor, $patch); -// Preserve suffix from the original version (e.g. -dev, -rc, -alpha, -beta) -// The suffix only changes when the branch changes, not on patch bumps -$suffix = $manifestSuffix ?? ''; -$newWithSuffix = $new . $suffix; +// -- Determine suffix to preserve (moko manifest takes priority, then Joomla) -- +$suffix = !empty($mokoSuffix) ? $mokoSuffix : (!empty($manifestSuffix) ? $manifestSuffix : ''); +$newFull = $suffix !== '' ? "{$new}-{$suffix}" : $new; -// -- Update .mokogitea/manifest.xml (canonical target) -- +// -- Update .mokogitea/manifest.xml (canonical — preserves suffix) -- if (file_exists($mokoManifest) && !empty($mokoContent)) { $updated = preg_replace( '|\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?|', - "{$newWithSuffix}", + "{$newFull}", $mokoContent, 1 ); @@ -129,7 +130,7 @@ if (file_exists($mokoManifest) && !empty($mokoContent)) { if (file_exists($readme) && !empty($readmeContent)) { $updated = preg_replace( '/(VERSION:\s*)\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?/m', - '${1}' . $newWithSuffix, + '${1}' . $newFull, $readmeContent, 1 ); @@ -154,7 +155,7 @@ foreach ($xmlPatterns as $pattern) { } $newContent = preg_replace( '|\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?|', - "{$newWithSuffix}", + "{$newFull}", $content ); if ($newContent !== $content) { @@ -174,7 +175,7 @@ if (file_exists($packageJsonFile)) { $pkgContent = file_get_contents($packageJsonFile); $updatedPkg = preg_replace( '/("version"\s*:\s*")\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?(")/m', - '${1}' . $newWithSuffix . '${2}', + '${1}' . $newFull . '${2}', $pkgContent ); if ($updatedPkg !== $pkgContent) { @@ -189,7 +190,7 @@ if (file_exists($pyprojectFile)) { $pyContent = file_get_contents($pyprojectFile); $updatedPy = preg_replace( '/^(version\s*=\s*")\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?(")/m', - '${1}' . $newWithSuffix . '${2}', + '${1}' . $newFull . '${2}', $pyContent ); if ($updatedPy !== $pyContent) { @@ -198,5 +199,6 @@ if (file_exists($pyprojectFile)) { } } -echo "{$old}{$suffix} -> {$newWithSuffix}\n"; +$oldFull = $suffix !== '' ? "{$old}-{$suffix}" : $old; +echo "{$oldFull} -> {$newFull}\n"; exit(0); diff --git a/cli/version_read.php b/cli/version_read.php index a6baedf..bdc2350 100644 --- a/cli/version_read.php +++ b/cli/version_read.php @@ -30,7 +30,7 @@ if (file_exists($mokoManifest)) { $xml = @simplexml_load_file($mokoManifest); if ($xml !== false) { $v = (string)($xml->identity->version ?? ''); - if (preg_match('/^\d{2}\.\d{2}\.\d{2}$/', $v)) { + if (preg_match('/^\d{2}\.\d{2}\.\d{2}(-[a-z]+)?$/', $v)) { $mokoVersion = $v; } } @@ -119,7 +119,7 @@ if ($version === null) { // -- Backfill: if manifest.xml exists but lacks , insert it -- if (file_exists($mokoManifest)) { $content = file_get_contents($mokoManifest); - if (!preg_match('|\d{2}\.\d{2}\.\d{2}|', $content)) { + if (!preg_match('|\d{2}\.\d{2}\.\d{2}(-[a-z]+)?|', $content)) { if (strpos($content, '