fix(website): support stable AppImage asset names

This commit is contained in:
Mohamed Boudra
2026-06-21 01:14:00 +07:00
parent 2d8acc1611
commit 9c86a410ea
3 changed files with 22 additions and 3 deletions
+3 -2
View File
@@ -6,17 +6,18 @@ export function releaseBase(version: string) {
export interface ReleaseAssetInfo {
version: string;
linuxAppImageAsset: string;
windowsX64Asset: string | null;
windowsArm64Asset: string | null;
}
export function downloadUrls(release: ReleaseAssetInfo) {
const { version, windowsX64Asset, windowsArm64Asset } = release;
const { version, linuxAppImageAsset, windowsX64Asset, windowsArm64Asset } = release;
const base = releaseBase(version);
return {
macAppleSilicon: `${base}/Paseo-${version}-arm64.dmg`,
macIntel: `${base}/Paseo-${version}-x64.dmg`,
linuxAppImage: `${base}/Paseo-${version}-x86_64.AppImage`,
linuxAppImage: `${base}/${linuxAppImageAsset}`,
linuxDeb: `${base}/Paseo-${version}-amd64.deb`,
linuxRpm: `${base}/Paseo-${version}-x86_64.rpm`,
windowsExeX64: `${base}/${windowsX64Asset ?? `Paseo-Setup-${version}.exe`}`,
+17 -1
View File
@@ -12,9 +12,12 @@ interface GitHubRelease {
draft: boolean;
}
const LINUX_APPIMAGE_ASSET_PATTERN =
/^Paseo-(?:\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)-)?x86_64\.AppImage$/;
const REQUIRED_ASSET_PATTERNS = [
/Paseo-.*-arm64\.dmg$/, // Mac Apple Silicon
/Paseo-.*-x86_64\.AppImage$/, // Linux AppImage
LINUX_APPIMAGE_ASSET_PATTERN, // Linux AppImage
/Paseo-Setup-.*\.exe$/, // Windows (any arch)
];
@@ -39,12 +42,17 @@ function pickWindowsAssets(assets: GitHubAsset[]) {
};
}
function pickLinuxAppImageAsset(assets: GitHubAsset[]) {
return assets.find((a) => LINUX_APPIMAGE_ASSET_PATTERN.test(a.name))?.name ?? null;
}
function versionFromTag(tag: string): string {
return tag.replace(/^v/, "");
}
interface ReleaseInfo {
version: string;
linuxAppImageAsset: string;
windowsX64Asset: string | null;
windowsArm64Asset: string | null;
}
@@ -70,8 +78,11 @@ async function fetchLatestReadyRelease(): Promise<ReleaseInfo> {
const ready = releases.find((r) => !r.prerelease && !r.draft && hasRequiredAssets(r));
if (!ready) throw new Error("no ready GitHub release found");
const win = pickWindowsAssets(ready.assets);
const linuxAppImageAsset = pickLinuxAppImageAsset(ready.assets);
if (!linuxAppImageAsset) throw new Error("ready release missing Linux AppImage asset");
return {
version: versionFromTag(ready.tag_name),
linuxAppImageAsset,
windowsX64Asset: win.x64,
windowsArm64Asset: win.arm64,
};
@@ -83,6 +94,11 @@ function isReleaseInfo(value: unknown): value is ReleaseInfo {
return (
typeof record.version === "string" &&
/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(record.version) &&
typeof record.linuxAppImageAsset === "string" &&
(record.linuxAppImageAsset === "Paseo-x86_64.AppImage" ||
new RegExp(`^Paseo-${record.version.replaceAll(".", "\\.")}-x86_64\\.AppImage$`).test(
record.linuxAppImageAsset,
)) &&
(typeof record.windowsX64Asset === "string" || record.windowsX64Asset === null) &&
(typeof record.windowsArm64Asset === "string" || record.windowsArm64Asset === null) &&
(record.windowsX64Asset === null ||
+2
View File
@@ -6,6 +6,7 @@ import { getStarCount } from "~/stars";
interface ReleaseContext {
version: string;
linuxAppImageAsset: string;
windowsX64Asset: string | null;
windowsArm64Asset: string | null;
}
@@ -16,6 +17,7 @@ interface StarsContext {
const ReleaseCtx = createContext<ReleaseContext>({
version: "",
linuxAppImageAsset: "",
windowsX64Asset: null,
windowsArm64Asset: null,
});