From ad488084ec73b4135f8dfe5100a805ecbed6d505 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Fri, 28 Jun 2024 09:53:18 -0400 Subject: [PATCH] Fix Flatpak release script --- CONTRIBUTING.md | 2 +- tasks.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d294dd..117ca53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ curl -o /c/opt/flatpak-cargo-generator.py https://raw.githubusercontent.com/flat pip install aiohttp toml ``` -Also install the Crowdin and `yq` CLI tools manually. +Also install the Crowdin CLI tool manually. #### Process * Update version in CHANGELOG.md diff --git a/tasks.py b/tasks.py index b301b63..b652685 100644 --- a/tasks.py +++ b/tasks.py @@ -161,14 +161,20 @@ def release(ctx): @task def release_flatpak(ctx, target="/git/com.github.mtkennerly.ludusavi"): target = Path(target) + spec = target / "com.github.mtkennerly.ludusavi.yaml" version = get_version() with ctx.cd(target): ctx.run("git checkout master") ctx.run("git pull") ctx.run(f"git checkout -b release/v{version}") + shutil.copy(DIST / "generated-sources.json", target / "generated-sources.json") - ctx.run(f"yq -i '.modules.0.sources.0.tag = \"v{version}\"' com.github.mtkennerly.ludusavi.yaml") + spec_content = spec.read_bytes().decode("utf-8") + spec_content = re.sub(r"( tag:) (.*)", fr"\1 v{version}", spec_content) + spec.write_bytes(spec_content.encode("utf-8")) + + ctx.run("git add .") ctx.run(f'git commit -m "Update for v{version}"') ctx.run("git push origin HEAD")