ci: add Linux ARM64 desktop release packages (#11518)
This commit is contained in:
@@ -6,6 +6,26 @@ const FALLBACK_URL = "https://github.com/aaif-goose/goose/releases/latest";
|
||||
|
||||
const isStandardLinuxAsset = (asset) => !asset.name.includes('-vulkan');
|
||||
|
||||
const ARCH_ASSET_TOKENS = {
|
||||
x64: { deb: 'amd64', rpm: 'x86_64', flatpak: 'x86_64' },
|
||||
arm64: { deb: 'arm64', rpm: 'arm64', flatpak: 'aarch64' },
|
||||
};
|
||||
|
||||
const detectLinuxArch = async () => {
|
||||
if (typeof navigator === 'undefined') return 'x64';
|
||||
|
||||
try {
|
||||
if (navigator.userAgentData?.getHighEntropyValues) {
|
||||
const { architecture } = await navigator.userAgentData.getHighEntropyValues(['architecture']);
|
||||
if (architecture) return /arm/i.test(architecture) ? 'arm64' : 'x64';
|
||||
}
|
||||
} catch {
|
||||
// Fall back to the user agent.
|
||||
}
|
||||
|
||||
return /aarch64|arm64/i.test(navigator.userAgent || '') ? 'arm64' : 'x64';
|
||||
};
|
||||
|
||||
const LinuxDesktopInstallButtons = () => {
|
||||
const [downloadUrls, setDownloadUrls] = useState({
|
||||
deb: FALLBACK_URL,
|
||||
@@ -16,9 +36,14 @@ const LinuxDesktopInstallButtons = () => {
|
||||
useEffect(() => {
|
||||
const fetchLatestRelease = async () => {
|
||||
try {
|
||||
const arch = await detectLinuxArch();
|
||||
const tokens = ARCH_ASSET_TOKENS[arch];
|
||||
const cacheKey = `goose-release-cache-${arch}`;
|
||||
const cacheTimeKey = `goose-release-cache-time-${arch}`;
|
||||
|
||||
// Check cache first (1 hour expiry)
|
||||
const cached = localStorage.getItem('goose-release-cache');
|
||||
const cacheTime = localStorage.getItem('goose-release-cache-time');
|
||||
const cached = localStorage.getItem(cacheKey);
|
||||
const cacheTime = localStorage.getItem(cacheTimeKey);
|
||||
const now = Date.now();
|
||||
|
||||
if (cached && cacheTime && (now - parseInt(cacheTime)) < 3600000) {
|
||||
@@ -36,13 +61,13 @@ const LinuxDesktopInstallButtons = () => {
|
||||
|
||||
// Find DEB, RPM, and Flatpak files
|
||||
const debAsset = assets.find(asset =>
|
||||
isStandardLinuxAsset(asset) && asset.name.includes('.deb') && asset.name.includes('amd64')
|
||||
isStandardLinuxAsset(asset) && asset.name.includes('.deb') && asset.name.includes(tokens.deb)
|
||||
);
|
||||
const rpmAsset = assets.find(asset =>
|
||||
isStandardLinuxAsset(asset) && asset.name.includes('.rpm') && asset.name.includes('x86_64')
|
||||
isStandardLinuxAsset(asset) && asset.name.includes('.rpm') && asset.name.includes(tokens.rpm)
|
||||
);
|
||||
const flatpakAsset = assets.find(asset =>
|
||||
isStandardLinuxAsset(asset) && asset.name.endsWith('.flatpak')
|
||||
isStandardLinuxAsset(asset) && asset.name.endsWith('.flatpak') && asset.name.includes(tokens.flatpak)
|
||||
);
|
||||
|
||||
const newUrls = {
|
||||
@@ -53,8 +78,8 @@ const LinuxDesktopInstallButtons = () => {
|
||||
|
||||
// Update state and cache
|
||||
setDownloadUrls(newUrls);
|
||||
localStorage.setItem('goose-release-cache', JSON.stringify(newUrls));
|
||||
localStorage.setItem('goose-release-cache-time', now.toString());
|
||||
localStorage.setItem(cacheKey, JSON.stringify(newUrls));
|
||||
localStorage.setItem(cacheTimeKey, now.toString());
|
||||
} catch (error) {
|
||||
console.warn('Failed to fetch latest release, using fallback URLs:', error);
|
||||
// Fallback URLs are already set in initial state
|
||||
|
||||
Reference in New Issue
Block a user