Skip to content

Commit e43e64f

Browse files
author
john2ai
committed
šŸ› fix(ci): generate updater manifests directly (tauri v2 has no latest.json)
The rewrite step searched for tauri v1-style latest.json files that v2 never emits, so all four platforms skipped manifest generation with a silent warning. Now the manifest is built from the tag version, the payload's .sig content, and the release download URL; Windows uses the NSIS .exe (the v2 updater artifact), and the release guard also requires the four updater JSONs
1 parent f20dcfb commit e43e64f

1 file changed

Lines changed: 36 additions & 35 deletions

File tree

ā€Ž.github/workflows/release.ymlā€Ž

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -263,48 +263,43 @@ jobs:
263263
[ -f "$f" ] && cp "$f" "$OUTPUT_DIR/$PREFIX.deb.sig"
264264
done
265265
266-
# Tauri writes `latest.json` per bundle type with relative artifact URLs.
267-
# Rewrite the URL for this platform to an absolute GitHub download link
268-
# and publish it under the endpoint's placeholder name.
269-
python3 - "$BUNDLE_DIR" "$OUTPUT_DIR" "$UPDATER_JSON" "$PREFIX" "$UPDATER_BASE" "${{ matrix.updater_target }}" "${{ matrix.updater_arch }}" <<'PY'
270-
import json, os, sys
271-
272-
bundle_dir, out_dir, updater_json, prefix, base, target, arch = sys.argv[1:]
266+
# Tauri v2 does NOT write a latest.json — build the updater manifest
267+
# from scratch: version from the tag, signature from the payload's
268+
# .sig file, URL pointing at the release download. One JSON per
269+
# platform, published under the endpoint's placeholder name.
270+
python3 - "$OUTPUT_DIR" "$UPDATER_JSON" "$PREFIX" "$UPDATER_BASE" "${{ matrix.updater_target }}" "${{ matrix.updater_arch }}" <<'PY'
271+
import datetime, json, os, sys
272+
273+
out_dir, updater_json, prefix, base, target, arch = sys.argv[1:]
274+
version = os.environ["GITHUB_REF_NAME"].lstrip("v")
273275
payload = {
274276
"darwin": f"{prefix}.app.tar.gz",
275277
"linux": f"{prefix}.AppImage",
276-
"windows": f"{prefix}.msi",
278+
"windows": f"{prefix}.exe",
277279
}[target]
278280
platform_key = f"{target}-{arch}"
279281
280-
candidates = []
281-
for root, _dirs, files in os.walk(bundle_dir):
282-
if "latest.json" in files:
283-
candidates.append(os.path.join(root, "latest.json"))
284-
285-
# Prefer the updater's preferred bundle type per platform.
286-
def rank(p):
287-
for i, name in enumerate(["appimage", "nsis", "msi", "deb", "macos"]):
288-
if name in p:
289-
return i
290-
return 99
291-
292-
candidates.sort(key=rank)
293-
chosen = None
294-
for c in candidates:
295-
with open(c) as fh:
296-
data = json.load(fh)
297-
if platform_key in data.get("platforms", {}):
298-
data["platforms"][platform_key]["url"] = f"{base}/{payload}"
299-
chosen = data
300-
break
301-
302-
if chosen is None:
303-
print(f"::warning::No updater latest.json for {platform_key}")
304-
sys.exit(0)
305-
282+
sig_file = os.path.join(out_dir, payload + ".sig")
283+
if not os.path.exists(sig_file):
284+
print(f"::error::missing updater signature {sig_file}")
285+
sys.exit(1)
286+
with open(sig_file) as fh:
287+
signature = fh.read().strip()
288+
289+
manifest = {
290+
"version": version,
291+
"notes": "",
292+
"pub_date": datetime.datetime.now(datetime.timezone.utc).isoformat(),
293+
"platforms": {
294+
platform_key: {
295+
"signature": signature,
296+
"url": f"{base}/{payload}",
297+
}
298+
},
299+
}
306300
with open(os.path.join(out_dir, updater_json), "w") as fh:
307-
json.dump(chosen, fh, indent=2)
301+
json.dump(manifest, fh, indent=2)
302+
print(f"Wrote updater manifest {updater_json} for {platform_key}")
308303
PY
309304
310305
- name: Upload artifact
@@ -343,6 +338,12 @@ jobs:
343338
exit 1
344339
fi
345340
done
341+
for uj in syscity-desktop-linux-x86_64.json syscity-desktop-darwin-aarch64.json syscity-desktop-darwin-x86_64.json syscity-desktop-windows-x86_64.json; do
342+
if [ ! -f "artifacts/$uj" ]; then
343+
echo "::error::missing updater manifest $uj"
344+
exit 1
345+
fi
346+
done
346347
for prefix in syscity-linux-amd64 syscity-linux-arm64 syscity-macos-arm64 syscity-macos-amd64; do
347348
if ! ls artifacts/ | grep -q "^${prefix}\.tar\.gz$"; then
348349
echo "::error::missing CLI tarball for ${prefix}"

0 commit comments

Comments
Ā (0)