From af86e2f8a1fe53441efd992f408e408835731675 Mon Sep 17 00:00:00 2001 From: mesalogo Date: Wed, 14 Oct 2026 00:22:53 +0800 Subject: [PATCH] fix(release): publish AppImages with SquashFS names --- .github/workflows/packages.yml | 12 +++++++++++- build/build-release.cjs | 27 +++++++++++++++++++++++++++ sites/release-index.js | 3 +++ sites/scripts/release-index.test.mjs | 4 ++-- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index deb1083c..e45f4a11 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -206,8 +206,9 @@ jobs: run: | set -euo pipefail sudo apt-get update - sudo apt-get install --no-install-recommends --yes rpm + sudo apt-get install --no-install-recommends --yes rpm file rpmbuild --version + file --version - name: Resolve macOS signing mode id: macos-signing @@ -312,6 +313,15 @@ jobs: ELECTRON_CACHE: ${{ runner.temp }}/electron ELECTRON_BUILDER_CACHE: ${{ runner.temp }}/electron-builder + - name: Verify AppImage uses SquashFS + if: matrix.platform == 'linux' + shell: bash + run: | + set -euo pipefail + appimage="$(find "dist/release/${{ matrix.platform }}-${{ matrix.arch }}" -maxdepth 1 -type f -name '*.AppImage' -print -quit)" + test -n "$appimage" + file "$appimage" | grep -qi squashfs + - name: Upload release packages uses: actions/upload-artifact@v7 with: diff --git a/build/build-release.cjs b/build/build-release.cjs index 95771ac3..aa57daef 100644 --- a/build/build-release.cjs +++ b/build/build-release.cjs @@ -1419,6 +1419,31 @@ function verifyArtifacts(directory, options) { } } +function normalizeAppImageArtifact(directory, options) { + if (!options.formats.includes('AppImage')) { + return + } + const candidates = readdirSync(directory, { withFileTypes: true }) + .filter((entry) => entry.isFile() && entry.name.endsWith('.AppImage')) + .map((entry) => entry.name) + if (candidates.length !== 1) { + throw new Error( + `AppImage 产物数量错误:${candidates.join(', ') || '未生成'}` + ) + } + const artifactName = + `${productName}-${packageJson.version}-` + + `${options.arch === 'x64' ? 'x86_64' : 'arm64'}.AppImage` + const source = join(directory, candidates[0]) + const destination = join(directory, artifactName) + if (source !== destination) { + if (existsSync(destination)) { + throw new Error(`AppImage 目标文件已存在:${artifactName}`) + } + renameSync(source, destination) + } +} + function verifyArtifactSignature(filePath, format, arch) { if (format === 'nsis') { if (readChunk(filePath, 2).toString('ascii') !== 'MZ') { @@ -1656,6 +1681,7 @@ async function main(argv = process.argv.slice(2)) { builderArguments, electronBuilderEnvironment(options) ) + normalizeAppImageArtifact(stagingDirectory, options) const unpackedDirectory = verifyUnpackedOutput( stagingDirectory, options @@ -1718,6 +1744,7 @@ module.exports = { verifyUnpackedOutput, verifyArtifacts, verifyArtifactSignature, + normalizeAppImageArtifact, verifyPortableZip, writeManifest } diff --git a/sites/release-index.js b/sites/release-index.js index f9b1acbc..d3e237f9 100644 --- a/sites/release-index.js +++ b/sites/release-index.js @@ -87,6 +87,9 @@ : format === "rpm" ? "aarch64" : "arm64"; + if (format === "AppImage") { + return `GoodBuddy-${version}-${artifactArch}.AppImage`; + } return `GoodBuddy-${version}-linux-${artifactArch}.${format}`; }; diff --git a/sites/scripts/release-index.test.mjs b/sites/scripts/release-index.test.mjs index 21e1dbd1..b372ed38 100644 --- a/sites/scripts/release-index.test.mjs +++ b/sites/scripts/release-index.test.mjs @@ -42,12 +42,12 @@ const canonicalFileName = (version, platform, arch, format) => { zip: `GoodBuddy-${version}-mac-arm64.zip`, }, "linux-x64": { - AppImage: `GoodBuddy-${version}-linux-x86_64.AppImage`, + AppImage: `GoodBuddy-${version}-x86_64.AppImage`, deb: `GoodBuddy-${version}-linux-amd64.deb`, rpm: `GoodBuddy-${version}-linux-x86_64.rpm`, }, "linux-arm64": { - AppImage: `GoodBuddy-${version}-linux-arm64.AppImage`, + AppImage: `GoodBuddy-${version}-arm64.AppImage`, deb: `GoodBuddy-${version}-linux-arm64.deb`, rpm: `GoodBuddy-${version}-linux-aarch64.rpm`, },