Check and Windows preview / check (patina) (push) Successful in 2m20s
Check and Windows preview / check (rivet) (push) Successful in 1m38s
Check and Windows preview / previews (push) Successful in 1m6s
Check and Windows preview / windows (push) Successful in 1m50s
Independent plugin release / publish (push) Successful in 8s
Independent plugin release / plan (push) Successful in 7s
Independent plugin release / build (push) Successful in 2m21s
28 lines
837 B
Python
28 lines
837 B
Python
"""Shared product metadata and independent release versions (Python 3.11+)."""
|
|
import json
|
|
from pathlib import Path
|
|
import re
|
|
import tomllib
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def catalog(root=ROOT):
|
|
return json.loads((root / "plugins/catalog.json").read_text())
|
|
|
|
|
|
def version(plugin, root=ROOT):
|
|
product = catalog(root)[plugin]
|
|
return tomllib.loads((root / product["manifest"]).read_text())["package"]["version"]
|
|
|
|
|
|
def tag_version(plugin, tag, root=ROOT):
|
|
match = re.fullmatch(re.escape(plugin) + r"-v(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)", tag)
|
|
if not match or match[1] != version(plugin, root):
|
|
raise ValueError(f"Expected {plugin}-v{version(plugin, root)}, got {tag!r}")
|
|
return match[1]
|
|
|
|
|
|
def archive_name(plugin, release_version):
|
|
return f"{plugin}-windows-x86_64-{release_version}.zip"
|