INNER CODE UNIT · Python
release_winget
mtkennerly/ludusavi · tasks.py:243
def release_winget(ctx, target="/git/_forks/winget-pkgs"):
target = Path(target)
version = get_version()
changelog = textwrap.indent(latest_changelog(), " ")
with ctx.cd(target):
ctx.run("git checkout master")
ctx.run("git pull upstream master")
ctx.run(f"git checkout -b mtkennerly.ludusavi-{version}")
ctx.run(f"wingetcreate update mtkennerly.ludusavi --version {version} --urls https://github.com/mtkennerly/ludusavi/releases/download/v{version}/ludusavi-v{version}-win64.zip https://github.com/mtkennerly/ludusavi/releases/download/v{version}/ludusavi-v{version}-win32.zip")
spec = target / f"manifests/m/mtkennerly/ludusavi/{version}/mtkennerly.ludusavi.locale.en-US.yaml"
spec_content = spec.read_bytes().decode("utf-8")
spec_content = spec_content.replace("Moniker: ludusavi", f"Moniker: ludusavi\nReleaseNotes: |-\n{changelog}\nReleaseNotesUrl: https://github.com/mtkennerly/ludusavi/releases/tag/v{version}")
spec.write_bytes(spec_content.encode("utf-8"))
ctx.run(f"winget validate --manifest manifests/m/mtkennerly/ludusavi/{version}")
ctx.run("git add .")