Use Gitea Releases for installation and ship VS Code highlighting
This commit is contained in:
1 parent
a46bd6e132
commit
201bdee372
243 files changed
+3289
-12521
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -198,18 +199,20 @@ def install_assets(assets, image, manifest):
|
||||
# Only transport is local: signature verification, full tar extraction and
|
||||
# the final bootstrap executable are the real first-install implementation.
|
||||
installer = load_installer()
|
||||
stem = f"dever-{manifest['platform']}"
|
||||
base = installer.RELEASES
|
||||
routes = {
|
||||
f"{base}/latest/{stem}.manifest.json": assets / f"{stem}.manifest.json",
|
||||
f"{base}/latest/{stem}.manifest.sig": assets / f"{stem}.manifest.sig",
|
||||
f"{base}/{manifest['version']}/{stem}.tar.zst": assets / f"{stem}.tar.zst",
|
||||
base = f"https://git.dever.cc/shemic/dever/releases/download/v{manifest['version']}"
|
||||
routes = {f"{base}/{path.name}": path for path in assets.iterdir() if path.is_file()}
|
||||
record = {
|
||||
"tag_name": f"v{manifest['version']}", "draft": False, "prerelease": False,
|
||||
"assets": [{"name": path.name, "size": path.stat().st_size,
|
||||
"browser_download_url": address} for address, path in routes.items()],
|
||||
}
|
||||
for artifact in manifest["artifacts"]:
|
||||
if artifact["path"] == "bootstrap/dever" or artifact["path"].startswith("bootstrap/lib/"):
|
||||
name = f"{stem}.blob-{artifact['sha256']}"
|
||||
routes[f"{base}/{manifest['version']}/{name}"] = assets / name
|
||||
installer.download = lambda address: routes[address].open("rb")
|
||||
|
||||
def download(address):
|
||||
if address == f"{installer.RELEASES}/latest":
|
||||
return io.BytesIO(json.dumps(record).encode())
|
||||
return routes[address].open("rb")
|
||||
|
||||
installer.download = download
|
||||
installer.install(argparse.Namespace(
|
||||
version="latest", release=None, system_root=image, no_start=True,
|
||||
trusted_key=WORKSPACE / "skills/assets/release.pub",
|
||||
|
||||
Reference in new issue
Block a user