From 299ec57b5247c40fa9fcd3243c2ababbaf35274e Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Mon, 25 May 2026 20:09:19 -0500 Subject: [PATCH] fix(ci): correct updates.xml regex to target stable channel block only The previous regex matched across channel boundaries because appears before in the XML. Fixed by matching the entire block containing the target channel tag, then replacing fields within that block only. Co-Authored-By: Claude Opus 4.6 (1M context) --- .mokogitea/workflows/deploy-mokogitea.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.mokogitea/workflows/deploy-mokogitea.yml b/.mokogitea/workflows/deploy-mokogitea.yml index 2a6fcfacd3..0754e78ebe 100644 --- a/.mokogitea/workflows/deploy-mokogitea.yml +++ b/.mokogitea/workflows/deploy-mokogitea.yml @@ -183,18 +183,18 @@ jobs: sha = data["sha"] content = base64.b64decode(data["content"]).decode("utf-8") - # Update stable channel version, infourl, and docker tag - content = re.sub( - r"(stable[\s\S]*?)[^<]*()", - rf"\g<1>{moko_ver}\2", content) - content = re.sub( - r"(stable[\s\S]*?]*>)[^<]*()", - rf"\g<1>{release_url}\2", content) - content = re.sub( - r"(stable[\s\S]*?]*>)[^<]*()", - rf"\g<1>{docker_img}\2", content) + # Update stable channel — match the block containing stable + def replace_channel(xml, channel, ver, url, docker): + pattern = rf"(\s*MokoGitea[\s\S]*?{channel}[\s\S]*?)" + def replacer(m): + block = m.group(1) + block = re.sub(r"[^<]*", f"{ver}", block) + block = re.sub(r"(]*>)[^<]*()", rf"\1{url}\2", block) + block = re.sub(r"(]*>)[^<]*()", rf"\1{docker}\2", block) + return block + return re.sub(pattern, replacer, xml) - # Also update VERSION comment at top + content = replace_channel(content, "stable", moko_ver, release_url, docker_img) content = re.sub(r"VERSION: [^\n]*", f"VERSION: {moko_ver}", content) # Push updated file