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