feat: centralized auto-bump workflow for all version bumps
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Universal: Cascade Main → Dev / Cascade main → branches (push) Successful in 3s
Universal: Auto Version Bump / Patch Bump (push) Successful in 4s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 50s
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Universal: Cascade Main → Dev / Cascade main → branches (push) Successful in 3s
Universal: Auto Version Bump / Patch Bump (push) Successful in 4s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 50s
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (push) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (push) Has been cancelled
Platform: moko-platform CI / CI Summary (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,94 @@
|
|||||||
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# FILE INFORMATION
|
||||||
|
# DEFGROUP: Gitea.Workflow
|
||||||
|
# INGROUP: moko-platform.Release
|
||||||
|
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
||||||
|
# PATH: /.mokogitea/workflows/auto-bump.yml
|
||||||
|
# VERSION: 09.02.00
|
||||||
|
# BRIEF: Auto patch-bump version on every push to dev
|
||||||
|
|
||||||
|
name: "Universal: Auto Version Bump"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump:
|
||||||
|
name: Patch Bump
|
||||||
|
runs-on: release
|
||||||
|
if: >-
|
||||||
|
!contains(github.event.head_commit.message, '[skip ci]') &&
|
||||||
|
!contains(github.event.head_commit.message, '[skip bump]')
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GA_TOKEN }}
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Setup moko-platform tools
|
||||||
|
run: |
|
||||||
|
if ! command -v composer &> /dev/null; then
|
||||||
|
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
if [ -d "/opt/moko-platform/cli" ]; then
|
||||||
|
echo "MOKO_CLI=/opt/moko-platform/cli" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
git clone --depth 1 --branch main --quiet \
|
||||||
|
"https://x-access-token:${{ secrets.GA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/moko-platform.git" \
|
||||||
|
/tmp/moko-platform-api
|
||||||
|
cd /tmp/moko-platform-api && composer install --no-dev --no-interaction --quiet
|
||||||
|
echo "MOKO_CLI=/tmp/moko-platform-api/cli" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
run: |
|
||||||
|
BRANCH="${{ github.ref_name }}"
|
||||||
|
|
||||||
|
# main = minor bump, dev = patch bump
|
||||||
|
if [ "$BRANCH" = "main" ]; then
|
||||||
|
BUMP_TYPE="--minor"
|
||||||
|
BUMP_LABEL="minor"
|
||||||
|
else
|
||||||
|
BUMP_TYPE=""
|
||||||
|
BUMP_LABEL="patch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BUMP=$(php ${MOKO_CLI}/version_bump.php --path . $BUMP_TYPE 2>&1) || true
|
||||||
|
echo "$BUMP"
|
||||||
|
|
||||||
|
VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null) || true
|
||||||
|
[ -z "$VERSION" ] && { echo "No version found — skipping"; exit 0; }
|
||||||
|
|
||||||
|
# Propagate to platform manifests
|
||||||
|
php ${MOKO_CLI}/version_set_platform.php \
|
||||||
|
--path . --version "$VERSION" --branch "$BRANCH" 2>/dev/null || true
|
||||||
|
php ${MOKO_CLI}/version_check.php --path . --fix 2>/dev/null || true
|
||||||
|
|
||||||
|
# Commit if anything changed
|
||||||
|
if git diff --quiet && git diff --cached --quiet; then
|
||||||
|
echo "No version changes to commit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
|
git config --local user.name "gitea-actions[bot]"
|
||||||
|
git remote set-url origin "https://jmiller:${{ secrets.GA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
|
||||||
|
git add -A
|
||||||
|
git commit -m "chore(version): ${BUMP_LABEL} bump to ${VERSION} [skip ci]" \
|
||||||
|
--author="gitea-actions[bot] <gitea-actions[bot]@mokoconsulting.tech>"
|
||||||
|
git push origin "$BRANCH"
|
||||||
|
echo "Bumped to ${VERSION} (${BUMP_LABEL})" >> $GITHUB_STEP_SUMMARY
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -92,8 +92,7 @@ jobs:
|
|||||||
release-candidate) SUFFIX="-rc"; TAG="release-candidate" ;;
|
release-candidate) SUFFIX="-rc"; TAG="release-candidate" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Patch bump via CLI tool
|
# Read current version (bump already handled by push workflow)
|
||||||
php ${MOKO_CLI}/version_bump.php --path .
|
|
||||||
VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null)
|
VERSION=$(php ${MOKO_CLI}/version_read.php --path . 2>/dev/null)
|
||||||
[ -z "$VERSION" ] && VERSION="00.00.01"
|
[ -z "$VERSION" ] && VERSION="00.00.01"
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ Version format: `XX.YY.ZZ` (zero-padded semver).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- `auto-bump.yml`: auto patch-bump version on every push to dev
|
||||||
|
- Removed redundant bump from pre-release.yml (handled by auto-bump)
|
||||||
|
|
||||||
## [09.02.00] - 2026-05-26
|
## [09.02.00] - 2026-05-26
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ DEFGROUP: MokoStandards.Root
|
|||||||
INGROUP: MokoStandards
|
INGROUP: MokoStandards
|
||||||
REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
|
||||||
PATH: /README.md
|
PATH: /README.md
|
||||||
VERSION: 09.02.00
|
VERSION: 09.02.01
|
||||||
BRIEF: Project overview and documentation
|
BRIEF: Project overview and documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
@@ -413,10 +413,15 @@ if ($isJoomlaPackage) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy language directory (package-level language files referenced in manifest)
|
// Include top-level directories (e.g. language/) that aren't packages/
|
||||||
if (is_dir("{$sourceDir}/language")) {
|
$topLevelDirs = glob("{$sourceDir}/*", GLOB_ONLYDIR) ?: [];
|
||||||
addDirToZip($zip, "{$sourceDir}/language", 'language', $excludePatterns);
|
foreach ($topLevelDirs as $tlDir) {
|
||||||
echo " Language files added from language/\n";
|
$dirName = basename($tlDir);
|
||||||
|
if ($dirName === 'packages') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
addDirToZip($zip, $tlDir, $dirName, $excludePatterns);
|
||||||
|
echo " Included dir: {$dirName}/\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|||||||
+12
-6
@@ -30,7 +30,7 @@ $mokoManifest = "{$root}/.mokogitea/manifest.xml";
|
|||||||
$mokoContent = '';
|
$mokoContent = '';
|
||||||
if (file_exists($mokoManifest)) {
|
if (file_exists($mokoManifest)) {
|
||||||
$mokoContent = file_get_contents($mokoManifest);
|
$mokoContent = file_get_contents($mokoManifest);
|
||||||
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})</version>|', $mokoContent, $m)) {
|
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})(?:-([a-z]+))?</version>|', $mokoContent, $m)) {
|
||||||
$mokoVersion = $m[1];
|
$mokoVersion = $m[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,15 +56,17 @@ $manifestFiles = array_merge(
|
|||||||
glob("{$root}/*.xml") ?: []
|
glob("{$root}/*.xml") ?: []
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$manifestSuffix = '';
|
||||||
foreach ($manifestFiles as $xmlFile) {
|
foreach ($manifestFiles as $xmlFile) {
|
||||||
$xmlContent = file_get_contents($xmlFile);
|
$xmlContent = file_get_contents($xmlFile);
|
||||||
if (strpos($xmlContent, '<extension') === false && strpos($xmlContent, '<version>') === false) {
|
if (strpos($xmlContent, '<extension') === false && strpos($xmlContent, '<version>') === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})(?:-[a-z]+)?</version>|', $xmlContent, $xm)) {
|
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})(?:-([a-z]+))?</version>|', $xmlContent, $xm)) {
|
||||||
$candidate = $xm[1];
|
$candidate = $xm[1];
|
||||||
if ($manifestVersion === null || version_compare($candidate, $manifestVersion, '>')) {
|
if ($manifestVersion === null || version_compare($candidate, $manifestVersion, '>')) {
|
||||||
$manifestVersion = $candidate;
|
$manifestVersion = $candidate;
|
||||||
|
$manifestSuffix = isset($xm[2]) ? $xm[2] : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,10 +108,14 @@ switch ($type) {
|
|||||||
|
|
||||||
$new = sprintf('%02d.%02d.%02d', $major, $minor, $patch);
|
$new = sprintf('%02d.%02d.%02d', $major, $minor, $patch);
|
||||||
|
|
||||||
// -- Update .mokogitea/manifest.xml (canonical target) --
|
// -- Determine suffix to preserve (from whichever source had the version) --
|
||||||
|
$suffix = !empty($manifestSuffix) ? $manifestSuffix : '';
|
||||||
|
$newFull = $suffix !== '' ? "{$new}-{$suffix}" : $new;
|
||||||
|
|
||||||
|
// -- Update .mokogitea/manifest.xml (canonical target, no suffix) --
|
||||||
if (file_exists($mokoManifest) && !empty($mokoContent)) {
|
if (file_exists($mokoManifest) && !empty($mokoContent)) {
|
||||||
$updated = preg_replace(
|
$updated = preg_replace(
|
||||||
'|<version>\d{2}\.\d{2}\.\d{2}</version>|',
|
'|<version>\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?</version>|',
|
||||||
"<version>{$new}</version>",
|
"<version>{$new}</version>",
|
||||||
$mokoContent,
|
$mokoContent,
|
||||||
1
|
1
|
||||||
@@ -146,7 +152,7 @@ foreach ($xmlPatterns as $pattern) {
|
|||||||
}
|
}
|
||||||
$newContent = preg_replace(
|
$newContent = preg_replace(
|
||||||
'|<version>\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?</version>|',
|
'|<version>\d{2}\.\d{2}\.\d{2}(?:-[a-z]+)?</version>|',
|
||||||
"<version>{$new}</version>",
|
"<version>{$newFull}</version>",
|
||||||
$content
|
$content
|
||||||
);
|
);
|
||||||
if ($newContent !== $content) {
|
if ($newContent !== $content) {
|
||||||
@@ -190,5 +196,5 @@ if (file_exists($pyprojectFile)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "{$old} -> {$new}\n";
|
echo "{$old} -> {$newFull}\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
+11
-1
@@ -54,6 +54,7 @@ if (file_exists($readme)) {
|
|||||||
|
|
||||||
// -- 3. Fallback: Joomla manifest XML --
|
// -- 3. Fallback: Joomla manifest XML --
|
||||||
$manifestVersion = null;
|
$manifestVersion = null;
|
||||||
|
$manifestVersionSuffix = '';
|
||||||
$manifestFiles = array_merge(
|
$manifestFiles = array_merge(
|
||||||
glob("{$root}/src/pkg_*.xml") ?: [],
|
glob("{$root}/src/pkg_*.xml") ?: [],
|
||||||
glob("{$root}/src/*.xml") ?: [],
|
glob("{$root}/src/*.xml") ?: [],
|
||||||
@@ -66,10 +67,12 @@ foreach ($manifestFiles as $xmlFile) {
|
|||||||
if (strpos($xmlContent, '<extension') === false && strpos($xmlContent, '<version>') === false) {
|
if (strpos($xmlContent, '<extension') === false && strpos($xmlContent, '<version>') === false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})(?:-[a-z]+)?</version>|', $xmlContent, $xm)) {
|
if (preg_match('|<version>(\d{2}\.\d{2}\.\d{2})(-[a-z]+)?</version>|', $xmlContent, $xm)) {
|
||||||
$candidate = $xm[1];
|
$candidate = $xm[1];
|
||||||
|
$candidateSuffix = isset($xm[2]) ? $xm[2] : '';
|
||||||
if ($manifestVersion === null || version_compare($candidate, $manifestVersion, '>')) {
|
if ($manifestVersion === null || version_compare($candidate, $manifestVersion, '>')) {
|
||||||
$manifestVersion = $candidate;
|
$manifestVersion = $candidate;
|
||||||
|
$manifestVersionSuffix = $candidateSuffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,9 +106,11 @@ $candidates = array_filter([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$version = null;
|
$version = null;
|
||||||
|
$versionSource = '';
|
||||||
foreach ($candidates as $candidate) {
|
foreach ($candidates as $candidate) {
|
||||||
if ($version === null || version_compare($candidate, $version, '>')) {
|
if ($version === null || version_compare($candidate, $version, '>')) {
|
||||||
$version = $candidate;
|
$version = $candidate;
|
||||||
|
$versionSource = ($candidate === $manifestVersion) ? 'manifest' : 'other';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +119,11 @@ if ($version === null) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Append suffix if the version came from a Joomla manifest with a suffix
|
||||||
|
if ($versionSource === 'manifest' && !empty($manifestVersionSuffix)) {
|
||||||
|
$version .= $manifestVersionSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
// -- Backfill: if manifest.xml exists but lacks <version>, insert it --
|
// -- Backfill: if manifest.xml exists but lacks <version>, insert it --
|
||||||
if (file_exists($mokoManifest)) {
|
if (file_exists($mokoManifest)) {
|
||||||
$content = file_get_contents($mokoManifest);
|
$content = file_get_contents($mokoManifest);
|
||||||
|
|||||||
Reference in New Issue
Block a user