Files
kst4contest/website/src/_data/downloads.js
T
Rsclub2_2andClaude Opus 5 af30c17a0d Macos signing (#80)
* Sign and notarize macOS builds

jpackage cannot produce a distributable macOS bundle on its own. It ad-hoc
signs the embedded runtime and then re-runs codesign on the same files without
--force, which codesign rejects; and "--type dmg --app-image" re-signs the app
it is handed, replacing a Developer ID signature with an ad-hoc one. So the
build now creates an unsigned app-image, signs it from the inside out, and
wraps it with hdiutil.

Apple's notary service also unpacks JARs and checks the native libraries
inside them, which sqlite-jdbc ships for both architectures. Those are signed
before the bundle is sealed, since rewriting a JAR afterwards would invalidate
the seal. A preflight check verifies Apple's two criteria locally, so a missed
binary costs seconds rather than a round trip to the notary service.

Two long-standing defects surfaced while testing and are fixed here: the
bundle identifier defaulted to the main class's package name (kst4contest.view
instead of de.x08.KST4Contest), and every release reported version 1.0 in
Finder because --app-version was never passed. Neither affects existing users:
the app keeps its settings in ~/.praktiKST, independent of the bundle ID.

Both workflows call the same script the local Mac uses, so the two cannot
drift apart. Signing needs a keychain that can answer a UI prompt, which a
runner cannot, so ci-import-cert.sh creates a throwaway keychain whose
password is generated per job and discarded with it. Notarization goes through
an App Store Connect API key and needs no keychain at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Sign bundle contents serially

Signing the app image's Mach-O files with "xargs -P 8" passed locally but
failed on a runner: codesign reported "replacing existing signature" and then
"No such file or directory" for that same path. The two libjli.dylib copies are
separate inodes, so this is not hard links being signed twice -- concurrent
codesign runs over one bundle are simply not reliable. Serially costs about a
minute, since each call waits on Apple's timestamp server.

Also stop the matrix from cancelling the other architecture on a failure; that
throws away half the diagnostic information from a failed run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Document macOS signing from 1.42

The installation guides described the right-click workaround as the normal
first launch. That stays, but as the path for 1.41.1 and older; from 1.42 a
double-click works. Both guides also show how to verify a download with spctl,
so the claim is checkable rather than something to take on faith.

The per-channel download notes distinguish where the channels actually stand:
Nightly is built from main and is signed as of now, while Stable still points
at 1.41.1, so those notes name the version instead of claiming it outright.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 16:48:31 +02:00

152 lines
5.1 KiB
JavaScript

const REPO = "praktimarc/kst4contest";
const API = `https://api.github.com/repos/${REPO}`;
const LATEST_RELEASE_URL = `https://github.com/${REPO}/releases/latest`;
async function fetchLatestReleaseTag() {
const headers = { Accept: "application/vnd.github+json" };
if (process.env.GITHUB_TOKEN) {
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
}
try {
const res = await fetch(`${API}/releases/latest`, { headers });
if (!res.ok) {
throw new Error(
`GitHub API /releases/latest failed: ${res.status}`
);
}
const release = await res.json();
if (!release.tag_name) {
throw new Error(
"GitHub API response did not contain a release tag"
);
}
return release.tag_name;
} catch (err) {
console.warn(
`[downloads] Could not load the latest release tag. ` +
`Download buttons will open the latest release page instead: ${err.message}`
);
return null;
}
}
/**
* Creates a direct link to an asset from the latest Stable release.
*
* If the GitHub API was unavailable during the build, the function deliberately
* returns the generic latest-release page instead of using a hard-coded and
* increasingly outdated fallback version.
*/
function createAssetUrl(latestTag, filenameTemplate) {
if (!latestTag) {
return LATEST_RELEASE_URL;
}
const filename = filenameTemplate.replace(/\{tag\}/g, latestTag);
return `https://github.com/${REPO}/releases/download/${latestTag}/${filename}`;
}
/**
* Builds the download list from the latest Stable GitHub release.
*
* The filenames must remain aligned with the artifacts produced by
* .github/workflows/tagged-release.yml.
*/
module.exports = async function () {
const latestTag = await fetchLatestReleaseTag();
const assetUrl = (filenameTemplate) =>
createAssetUrl(latestTag, filenameTemplate);
return [
{
os: "Windows",
format: "ZIP x64",
icon: "🪟",
recommended: true,
note: "Extract the complete archive, then start praktiKST.exe. No separate Java installation is required.",
url: assetUrl("praktiKST-{tag}-windows-x64.zip")
},
{
os: "Linux",
format: "Flatpak (.flatpakref)",
icon: "🐧",
recommended: true,
note: "Installs through Flatpak and can be updated through Flatpak or the desktop software centre.",
url: assetUrl("de.x08.KST4Contest.flatpakref")
},
{
os: "Linux",
format: "AppImage x86_64",
icon: "🐧",
recommended: false,
note: "Portable build without package installation. Make the downloaded file executable before the first launch.",
url: assetUrl("KST4Contest-{tag}-linux-x86_64.AppImage")
},
{
os: "Debian / Ubuntu",
format: "DEB amd64",
icon: "📦",
recommended: false,
note: "Native package for Debian, Ubuntu and distributions based on them.",
url: assetUrl("KST4Contest-{tag}-debian-amd64.deb")
},
{
os: "Fedora",
format: "RPM x86_64",
icon: "📦",
recommended: false,
note: "Native package built for Fedora and compatible RPM-based systems.",
url: assetUrl("KST4Contest-{tag}-fedora-x86_64.rpm")
},
{
os: "Arch Linux",
format: "pkg.tar.zst",
icon: "📦",
recommended: false,
note: "Release package for direct installation with pacman. AUR alternatives are described in the installation guide.",
url: assetUrl(
"KST4Contest-{tag}-archlinux-x86_64.pkg.tar.zst"
)
},
{
os: "macOS Apple Silicon",
format: "DMG arm64",
icon: "🍎",
recommended: false,
note: "Best-effort build for Apple Silicon Macs. Signed and notarized by Apple from version 1.42 onwards.",
url: assetUrl("KST4Contest-{tag}-macos-arm64.dmg")
},
{
os: "macOS Intel",
format: "DMG x86_64",
icon: "🍎",
recommended: false,
note: "Best-effort build for Intel Macs. Signed and notarized by Apple from version 1.42 onwards.",
url: assetUrl("KST4Contest-{tag}-macos-x86_64.dmg")
},
{
os: "Manual English",
format: "PDF",
icon: "📘",
recommended: false,
note: "English PDF manual included with the Stable release.",
url: assetUrl("KST4Contest-{tag}-manual-en.pdf")
},
{
os: "Manual German",
format: "PDF",
icon: "📘",
recommended: false,
note: "German PDF manual included with the Stable release.",
url: assetUrl("KST4Contest-{tag}-manual-de.pdf")
}
];
};