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:
+27
-22
@@ -72,6 +72,7 @@ class _Platform(NamedTuple):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
tag: str # win64 / macos / linux
|
tag: str # win64 / macos / linux
|
||||||
|
channel: str # Velopack update channel: win / osx / linux
|
||||||
rid: str # Velopack runtime id
|
rid: str # Velopack runtime id
|
||||||
dist_dir: str # PyInstaller output dir under build/
|
dist_dir: str # PyInstaller output dir under build/
|
||||||
icon: str # file in mediahive/assets
|
icon: str # file in mediahive/assets
|
||||||
@@ -81,10 +82,10 @@ class _Platform(NamedTuple):
|
|||||||
|
|
||||||
def _platform() -> _Platform:
|
def _platform() -> _Platform:
|
||||||
if sys.platform == "win32":
|
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":
|
if sys.platform == "darwin":
|
||||||
return _Platform("macos", "osx-arm64", "MediaHive.app", "mediahive.icns", "MediaHive", ".pkg")
|
return _Platform("macos", "osx", "osx-arm64", "MediaHive.app", "mediahive.icns", "MediaHive", ".pkg")
|
||||||
return _Platform("linux", "linux-x64", "MediaHive", "mediahive.png", "MediaHive", ".AppImage")
|
return _Platform("linux", "linux", "linux-x64", "MediaHive", "mediahive.png", "MediaHive", ".AppImage")
|
||||||
|
|
||||||
|
|
||||||
def setup_artifact_name(version: str) -> str:
|
def setup_artifact_name(version: str) -> str:
|
||||||
@@ -383,30 +384,34 @@ def build_velopack(version: str) -> Path:
|
|||||||
artifact = _REPO_ROOT / "build" / setup_artifact_name(version)
|
artifact = _REPO_ROOT / "build" / setup_artifact_name(version)
|
||||||
artifact.unlink(missing_ok=True)
|
artifact.unlink(missing_ok=True)
|
||||||
setup.rename(artifact)
|
setup.rename(artifact)
|
||||||
rename_feed_packages(releases_dir)
|
rename_feed_package(releases_dir, version, plat.channel)
|
||||||
return artifact
|
return artifact
|
||||||
|
|
||||||
|
|
||||||
def rename_feed_packages(releases_dir: Path) -> None:
|
def rename_feed_package(releases_dir: Path, version: str, channel: str) -> None:
|
||||||
"""Lowercase the update-feed nupkgs in place.
|
"""Rename this platform's update-feed nupkg in place.
|
||||||
|
|
||||||
Gitea sorts release assets with capitals first: MediaHive-*-full.nupkg
|
vpk hardcodes MediaHive-{ver}[-{channel}]-full.nupkg (Windows, the legacy
|
||||||
listed right between the Setup/AppImage downloads invites confusion.
|
default channel, gets no marker). Rename all to the uniform
|
||||||
As mediahive-*-full.nupkg they group with the wheel/sdist instead.
|
mediahive-{ver}-{channel}-full.nupkg: lowercase groups them with the
|
||||||
The feed manifests reference the filename, so patch those too.
|
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 = [
|
old_name = f"MediaHive-{version}-full.nupkg"
|
||||||
p
|
if not (releases_dir / old_name).exists():
|
||||||
for pattern in ("RELEASES", "releases.*.json", "assets.*.json")
|
old_name = f"MediaHive-{version}-{channel}-full.nupkg"
|
||||||
for p in releases_dir.glob(pattern)
|
nupkg = releases_dir / old_name
|
||||||
]
|
if not nupkg.exists():
|
||||||
for nupkg in releases_dir.glob("MediaHive-*-full.nupkg"):
|
raise RuntimeError(f"vpk produced no {old_name} in {releases_dir}")
|
||||||
new_name = "mediahive-" + nupkg.name.removeprefix("MediaHive-")
|
|
||||||
for manifest in manifests:
|
new_name = f"mediahive-{version}-{channel}-full.nupkg"
|
||||||
text = manifest.read_text()
|
manifest = releases_dir / f"releases.{channel}.json"
|
||||||
if nupkg.name in text:
|
text = manifest.read_text()
|
||||||
manifest.write_text(text.replace(nupkg.name, new_name))
|
if old_name not in text:
|
||||||
nupkg.rename(nupkg.with_name(new_name))
|
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))
|
||||||
|
|
||||||
|
|
||||||
def force_macos_user_install(pkg: Path) -> None:
|
def force_macos_user_install(pkg: Path) -> None:
|
||||||
|
|||||||
+5
-3
@@ -118,14 +118,16 @@ def find_dist_files(version: str) -> list[Path]:
|
|||||||
def find_velopack_feed_files() -> list[Path]:
|
def find_velopack_feed_files() -> list[Path]:
|
||||||
"""Velopack update feed files produced by vpk pack in build/velopack/.
|
"""Velopack update feed files produced by vpk pack in build/velopack/.
|
||||||
|
|
||||||
These keep their original names — the feed JSONs reference them — and
|
Only what the in-app updater (GiteaSource) reads from the latest
|
||||||
in-app updates (GiteaSource) download them from the latest release.
|
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"
|
releases_dir = REPO_ROOT / "build" / "velopack"
|
||||||
if not releases_dir.exists():
|
if not releases_dir.exists():
|
||||||
return []
|
return []
|
||||||
files: list[Path] = []
|
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)))
|
files.extend(sorted(releases_dir.glob(pattern)))
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user