fix: fetch updates.xml from main, discard stale version entries
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (push) Has been cancelled
Platform: moko-platform CI / Gate 1: Code Quality (pull_request) Has been cancelled
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
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: moko-platform CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: moko-platform CI / CI Summary (pull_request) 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
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Generic: Repo Health / Release configuration (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled

- auto-release: fetch existing updates.xml from main before building
- updates_xml_build: discard preserved entries with versions lower
  than the current release to prevent stale data leaking through

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-29 22:27:31 -05:00
parent f7a6e0bae7
commit e477760b33
2 changed files with 19 additions and 5 deletions
+7 -3
View File
@@ -411,9 +411,13 @@ jobs:
VERSION="${{ steps.bump.outputs.version || steps.version.outputs.version }}"
SHA256="${{ steps.package.outputs.sha256_zip }}"
# For stable releases, start with a clean updates.xml
# Stable writes ALL channels so no entries need preserving
rm -f updates.xml
# Fetch latest updates.xml from main so preserve logic has current channels
GITEA_TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
curl -sf -H "Authorization: token ${GITEA_TOKEN}" \
"${API}/contents/updates.xml?ref=main" 2>/dev/null | \
php -r "\$d=json_decode(file_get_contents('php://stdin'),true); echo base64_decode(\$d['content'] ?? '');" \
> updates.xml 2>/dev/null || rm -f updates.xml
SHA_FLAG=""
[ -n "$SHA256" ] && SHA_FLAG="--sha ${SHA256}"
+12 -2
View File
@@ -491,9 +491,19 @@ if (file_exists($dest)) {
if (isset($existingUpdate->tags->tag)) {
$existingTag = (string) $existingUpdate->tags->tag;
}
// Keep entries for channels we're NOT overwriting
$existingVersion = (string) ($existingUpdate->version ?? '');
// Strip suffixes for comparison
$existingBase = preg_replace('/(-(dev|alpha|beta|rc))+$/', '', $existingVersion);
$currentBase = preg_replace('/(-(dev|alpha|beta|rc))+$/', '', $version);
// Keep entries for channels we're NOT overwriting,
// but ONLY if their version is >= current (never preserve stale entries)
if (!empty($existingTag) && !in_array($existingTag, $writtenChannels, true)) {
$preservedEntries[] = ' ' . trim($existingUpdate->asXML());
if (version_compare($existingBase, $currentBase, '>=')) {
$preservedEntries[] = ' ' . trim($existingUpdate->asXML());
} else {
echo "Discarding stale {$existingTag} entry (v{$existingVersion} < v{$version})\n";
}
}
}
}