From 5d63ecb8b7a2db8529655b28682a5024b86f21e7 Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Thu, 18 Dec 2025 19:04:34 -0600 Subject: [PATCH] Update version_branch.yml --- .github/workflows/version_branch.yml | 64 +++++++++++++--------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index a76789b..63f777d 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -1,4 +1,3 @@ ---- # # Copyright (C) 2025 Moko Consulting # @@ -462,58 +461,53 @@ jobs: raise SystemExit(0) PY - - name: Post bump audit (version consistency) + - name: Post bump audit (updates.xml date only) run: | source "$CI_HELPERS" - moko_init "Post bump audit" + moko_init "Post bump audit (updates.xml date only)" python3 - <<'PY' - import os + import json import re from pathlib import Path - new_version = (os.environ.get('NEW_VERSION') or '').strip() - if not new_version: - raise SystemExit('[FATAL] NEW_VERSION env var missing') + report_path = Path('.github/version-bump-report.json') + if not report_path.exists(): + print('[INFO] No bump report found. Skipping updates.xml audit.') + raise SystemExit(0) - root = Path('.').resolve() - skip_dirs = {'.git', '.github', 'node_modules', 'vendor', '.venv', 'dist', 'build'} + report = json.loads(report_path.read_text(encoding='utf-8', errors='replace')) + stamp = (report.get('stamp_utc') or '').strip() + if not stamp: + print('[INFO] No stamp_utc in bump report. Skipping updates.xml audit.') + raise SystemExit(0) - header_re = re.compile(r'(?im)VERSION[ ]*:[ ]*([0-9]{2}[.][0-9]{2}[.][0-9]{2})') - xml_version_re = re.compile(r'(?is)([^<]*?)') + p = Path('updates.xml') + if not p.exists(): + print('[INFO] updates.xml not present. Skipping updates.xml date audit.') + raise SystemExit(0) + text = p.read_text(encoding='utf-8', errors='replace') + + tags = ['creationDate', 'date', 'releaseDate'] mismatches = [] - for p in root.rglob('*'): - if not p.is_file(): + for t in tags: + rx = re.compile(r'(?is)<' + re.escape(t) + r'\\s*>([^<]*?)') + m = rx.search(text) + if not m: continue - parts = {x.lower() for x in p.parts} - if any(d in parts for d in skip_dirs): - continue - if p.suffix.lower() in {'.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.pdf', '.zip', '.7z', '.tar', '.gz', '.woff', '.woff2', '.ttf', '.otf', '.mp3', '.mp4', '.json'}: - continue - - try: - text = p.read_text(encoding='utf-8', errors='replace') - except Exception: - continue - - for m in header_re.finditer(text): - if m.group(1).strip() != new_version: - mismatches.append(str(p) + ' :: VERSION: ' + m.group(1).strip()) - - if p.suffix.lower() == '.xml' and ' ' + m.group(1).strip()) + current = (m.group(1) or '').strip() + if current != stamp: + mismatches.append('<' + t + '> ' + current + ' != ' + stamp) if mismatches: - print('[ERROR] Version consistency audit failed. Mismatches found:') - for x in mismatches[:200]: + print('[ERROR] updates.xml date audit failed. Mismatches found:') + for x in mismatches: print(' ' + x) raise SystemExit(2) - print('[INFO] Version consistency audit passed') + print('[INFO] updates.xml date audit passed') PY - name: Change scope guard (block .github edits)