Upload only the consumed feed files; uniform nupkg names
release.py no longer uploads the legacy RELEASES and assets.*.json
manifests — the in-app updater reads only releases.<channel>.json plus
the nupkg it references. The Windows feed nupkg gains its -win channel
marker (vpk omits it for the legacy default channel), so all platforms
are uniformly mediahive-{ver}-{channel}-full.nupkg. The -full suffix is
Velopack's asset type and stays.
This commit is contained in:
+25
-20
@@ -72,6 +72,7 @@ class _Platform(NamedTuple):
|
||||
"""
|
||||
|
||||
tag: str # win64 / macos / linux
|
||||
channel: str # Velopack update channel: win / osx / linux
|
||||
rid: str # Velopack runtime id
|
||||
dist_dir: str # PyInstaller output dir under build/
|
||||
icon: str # file in mediahive/assets
|
||||
@@ -81,10 +82,10 @@ class _Platform(NamedTuple):
|
||||
|
||||
def _platform() -> _Platform:
|
||||
if sys.platform == "win32":
|
||||
return _Platform("win64", "win-x64", "MediaHive", "mediahive.ico", "MediaHive.exe", ".exe")
|
||||
return _Platform("win64", "win", "win-x64", "MediaHive", "mediahive.ico", "MediaHive.exe", ".exe")
|
||||
if sys.platform == "darwin":
|
||||
return _Platform("macos", "osx-arm64", "MediaHive.app", "mediahive.icns", "MediaHive", ".pkg")
|
||||
return _Platform("linux", "linux-x64", "MediaHive", "mediahive.png", "MediaHive", ".AppImage")
|
||||
return _Platform("macos", "osx", "osx-arm64", "MediaHive.app", "mediahive.icns", "MediaHive", ".pkg")
|
||||
return _Platform("linux", "linux", "linux-x64", "MediaHive", "mediahive.png", "MediaHive", ".AppImage")
|
||||
|
||||
|
||||
def setup_artifact_name(version: str) -> str:
|
||||
@@ -383,29 +384,33 @@ def build_velopack(version: str) -> Path:
|
||||
artifact = _REPO_ROOT / "build" / setup_artifact_name(version)
|
||||
artifact.unlink(missing_ok=True)
|
||||
setup.rename(artifact)
|
||||
rename_feed_packages(releases_dir)
|
||||
rename_feed_package(releases_dir, version, plat.channel)
|
||||
return artifact
|
||||
|
||||
|
||||
def rename_feed_packages(releases_dir: Path) -> None:
|
||||
"""Lowercase the update-feed nupkgs in place.
|
||||
def rename_feed_package(releases_dir: Path, version: str, channel: str) -> None:
|
||||
"""Rename this platform's update-feed nupkg in place.
|
||||
|
||||
Gitea sorts release assets with capitals first: MediaHive-*-full.nupkg
|
||||
listed right between the Setup/AppImage downloads invites confusion.
|
||||
As mediahive-*-full.nupkg they group with the wheel/sdist instead.
|
||||
The feed manifests reference the filename, so patch those too.
|
||||
vpk hardcodes MediaHive-{ver}[-{channel}]-full.nupkg (Windows, the legacy
|
||||
default channel, gets no marker). Rename all to the uniform
|
||||
mediahive-{ver}-{channel}-full.nupkg: lowercase groups them with the
|
||||
wheel/sdist below the capitalized user downloads on the release page,
|
||||
and every platform carries its channel. releases.<channel>.json
|
||||
references the filename, so patch it too.
|
||||
"""
|
||||
manifests = [
|
||||
p
|
||||
for pattern in ("RELEASES", "releases.*.json", "assets.*.json")
|
||||
for p in releases_dir.glob(pattern)
|
||||
]
|
||||
for nupkg in releases_dir.glob("MediaHive-*-full.nupkg"):
|
||||
new_name = "mediahive-" + nupkg.name.removeprefix("MediaHive-")
|
||||
for manifest in manifests:
|
||||
old_name = f"MediaHive-{version}-full.nupkg"
|
||||
if not (releases_dir / old_name).exists():
|
||||
old_name = f"MediaHive-{version}-{channel}-full.nupkg"
|
||||
nupkg = releases_dir / old_name
|
||||
if not nupkg.exists():
|
||||
raise RuntimeError(f"vpk produced no {old_name} in {releases_dir}")
|
||||
|
||||
new_name = f"mediahive-{version}-{channel}-full.nupkg"
|
||||
manifest = releases_dir / f"releases.{channel}.json"
|
||||
text = manifest.read_text()
|
||||
if nupkg.name in text:
|
||||
manifest.write_text(text.replace(nupkg.name, new_name))
|
||||
if old_name not in text:
|
||||
raise RuntimeError(f"{manifest.name} does not reference {old_name}")
|
||||
manifest.write_text(text.replace(old_name, new_name))
|
||||
nupkg.rename(nupkg.with_name(new_name))
|
||||
|
||||
|
||||
|
||||
+5
-3
@@ -118,14 +118,16 @@ def find_dist_files(version: str) -> list[Path]:
|
||||
def find_velopack_feed_files() -> list[Path]:
|
||||
"""Velopack update feed files produced by vpk pack in build/velopack/.
|
||||
|
||||
These keep their original names — the feed JSONs reference them — and
|
||||
in-app updates (GiteaSource) download them from the latest release.
|
||||
Only what the in-app updater (GiteaSource) reads from the latest
|
||||
release: this channel's releases.<channel>.json index and the nupkg
|
||||
payload it points to. The legacy RELEASES and assets.*.json manifests
|
||||
(Squirrel compat / setup bootstrap) are not uploaded.
|
||||
"""
|
||||
releases_dir = REPO_ROOT / "build" / "velopack"
|
||||
if not releases_dir.exists():
|
||||
return []
|
||||
files: list[Path] = []
|
||||
for pattern in ("RELEASES", "releases.*.json", "assets.*.json", "*.nupkg"):
|
||||
for pattern in ("releases.*.json", "*.nupkg"):
|
||||
files.extend(sorted(releases_dir.glob(pattern)))
|
||||
return files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user