From 3e41c93a95cf93d99d77bcc61ae5863ec5d22941 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Wed, 2 Dec 2026 00:00:57 +0800 Subject: [PATCH] fix(ci): skip RPM bundles in nightly builds (#7258) Co-authored-by: Cursor --- .github/workflows/release-build.yml | 6 +- scripts/nightly-prepare.test.ts | 7 +- scripts/nightly-prepare.ts | 12 ++- scripts/updater-manifest.test.ts | 126 +++++++++++++++------------- 4 files changed, 86 insertions(+), 65 deletions(-) diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index a26d015c42..9061d8f95d 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -284,6 +284,8 @@ jobs: return; } // Bundle suffix → updater platform keys, as tauri-action names them. + // Nightly builds skip RPM because RPM rejects `-` in SemVer prerelease versions. + const nightly = tag.includes("-nightly."); const windows = (arch, msi, nsis) => [ [msi, [`windows-${arch}`, `windows-${arch}-msi`]], [nsis, [`windows-${arch}-nsis`]], @@ -291,10 +293,10 @@ jobs: const kinds = [ [/_aarch64\.AppImage$/, ["linux-aarch64", "linux-aarch64-appimage"]], [/_arm64\.deb$/, ["linux-aarch64-deb"]], - [/\.aarch64\.rpm$/, ["linux-aarch64-rpm"]], + ...(nightly ? [] : [[/\.aarch64\.rpm$/, ["linux-aarch64-rpm"]]]), [/_amd64\.AppImage$/, ["linux-x86_64", "linux-x86_64-appimage"]], [/_amd64\.deb$/, ["linux-x86_64-deb"]], - [/\.x86_64\.rpm$/, ["linux-x86_64-rpm"]], + ...(nightly ? [] : [[/\.x86_64\.rpm$/, ["linux-x86_64-rpm"]]]), [/_aarch64\.app\.tar\.gz$/, ["darwin-aarch64", "darwin-aarch64-app"]], [/_x64\.app\.tar\.gz$/, ["darwin-x86_64", "darwin-x86_64-app"]], ...windows("aarch64", /_arm64_en-US\.msi$/, /_arm64-setup\.exe$/), diff --git a/scripts/nightly-prepare.test.ts b/scripts/nightly-prepare.test.ts index 105f474eaa..a14e559c82 100644 --- a/scripts/nightly-prepare.test.ts +++ b/scripts/nightly-prepare.test.ts @@ -1,6 +1,6 @@ // @vitest-environment node import { describe, expect, it } from "vitest"; -import { NIGHTLY_ENDPOINT, msiVersion, nightlyVersion, setNightlyConfig } from "./nightly-prepare.ts"; +import { NIGHTLY_ENDPOINT, NIGHTLY_TARGETS, msiVersion, nightlyVersion, setNightlyConfig } from "./nightly-prepare.ts"; describe("nightlyVersion", () => { it("is the next patch's nightly once the current version is released", () => { @@ -36,7 +36,7 @@ describe("msiVersion", () => { }); describe("setNightlyConfig", () => { - it("sets the version, the nightly manifest and the MSI version, keeping the rest", () => { + it("sets the version, the nightly manifest, the MSI version and drops RPM, keeping the rest", () => { const json = JSON.stringify( { version: "0.1.55", @@ -50,10 +50,11 @@ describe("setNightlyConfig", () => { expect(config.version).toBe("0.1.56-nightly.20261130"); expect(config.plugins.updater).toEqual({ pubkey: "key", endpoints: [NIGHTLY_ENDPOINT] }); expect(config.bundle).toEqual({ - targets: "all", + targets: NIGHTLY_TARGETS, macOS: { minimumSystemVersion: "11.0" }, windows: { wix: { version: "0.1.55.42" } }, }); + expect(config.bundle.targets).not.toContain("rpm"); }); it("refuses a config without the updater", () => { diff --git a/scripts/nightly-prepare.ts b/scripts/nightly-prepare.ts index a9b0539453..936db93943 100644 --- a/scripts/nightly-prepare.ts +++ b/scripts/nightly-prepare.ts @@ -23,6 +23,13 @@ import { /** The nightly channel's updater manifest: the rolling `nightly` release (nightly.yml). */ export const NIGHTLY_ENDPOINT = "https://github.com/l0ng-ai/openidea/releases/download/nightly/latest.json"; +/** + * Bundle targets built for a nightly: every target except RPM, whose package version rejects + * the `-` in SemVer prerelease strings (`0.1.57-nightly.20261201`) and whose Tauri config has + * no separate version field. + */ +export const NIGHTLY_TARGETS = ["app", "dmg", "appimage", "deb", "msi", "nsis"]; + function bump(version: string): string { const [major, minor, patch] = version.split(".").map(Number); return `${major}.${minor}.${patch! + 1}`; @@ -49,15 +56,16 @@ export function msiVersion(current: string, released: boolean, build: number): s return `${major}.${minor}.${last}.${build}`; } -/** tauri.conf.json for a nightly: its version, the nightly updater manifest and the MSI version. */ +/** tauri.conf.json for a nightly: its version, the nightly updater manifest, the MSI version and targets without RPM. */ export function setNightlyConfig(json: string, version: string, msi: string): string { const config = JSON.parse(setJsonVersion(json, version)) as { plugins?: { updater?: { endpoints?: string[] } }; - bundle?: { windows?: { wix?: { version?: string } } }; + bundle?: { targets?: string | string[]; windows?: { wix?: { version?: string } } }; }; if (!config.plugins?.updater) throw new Error("tauri.conf.json: no plugins.updater"); config.plugins.updater.endpoints = [NIGHTLY_ENDPOINT]; config.bundle ??= {}; + config.bundle.targets = NIGHTLY_TARGETS; config.bundle.windows ??= {}; config.bundle.windows.wix = { ...config.bundle.windows.wix, version: msi }; return `${JSON.stringify(config, null, 2)}\n`; diff --git a/scripts/updater-manifest.test.ts b/scripts/updater-manifest.test.ts index 4fc152fd3e..a3b35eb656 100644 --- a/scripts/updater-manifest.test.ts +++ b/scripts/updater-manifest.test.ts @@ -12,63 +12,73 @@ const run = new Function("github", "context", "core", `return (async () => {${sc afterEach(() => vi.unstubAllEnvs()); -it("publishes signed portable updates for both Windows architectures alongside the installers", async () => { - const tag = "v0.1.42"; - vi.stubEnv("TAG", tag); - vi.stubEnv("RELEASE_ID", "42"); - const version = tag.slice(1); - const bundles = [ - "OpenIDEA_aarch64.AppImage", - "OpenIDEA_arm64.deb", - "OpenIDEA.aarch64.rpm", - "OpenIDEA_amd64.AppImage", - "OpenIDEA_amd64.deb", - "OpenIDEA.x86_64.rpm", - "OpenIDEA_aarch64.app.tar.gz", - "OpenIDEA_x64.app.tar.gz", - "OpenIDEA_arm64_en-US.msi", - "OpenIDEA_arm64-setup.exe", - "OpenIDEA_x64_en-US.msi", - "OpenIDEA_x64-setup.exe", - `OpenIDEA_${version}_windows_x64_portable.zip`, - `OpenIDEA_${version}_windows_arm64_portable.zip`, - ]; - const assets = bundles.flatMap((name, id) => [ - { name, id: id * 2 }, - { name: `${name}.sig`, id: id * 2 + 1 }, - ]); - const upload = vi.fn(); - const failed = vi.fn(); - await run( - { - paginate: async () => assets, - rest: { - repos: { - listReleaseAssets: vi.fn(), - getRelease: async () => ({ data: { body: "Release notes" } }), - getReleaseAsset: async ({ asset_id }: { asset_id: number }) => ({ - data: Buffer.from(`signature-${asset_id}\n`), - }), - uploadReleaseAsset: upload, +it.each(["v0.1.42", "v0.1.57-nightly.20261201"])( + "publishes signed portable updates for both Windows architectures alongside the installers (%s)", + async (tag) => { + vi.stubEnv("TAG", tag); + vi.stubEnv("RELEASE_ID", "42"); + const version = tag.slice(1); + const nightly = tag.includes("-nightly."); + const bundles = [ + "OpenIDEA_aarch64.AppImage", + "OpenIDEA_arm64.deb", + "OpenIDEA.aarch64.rpm", + "OpenIDEA_amd64.AppImage", + "OpenIDEA_amd64.deb", + "OpenIDEA.x86_64.rpm", + "OpenIDEA_aarch64.app.tar.gz", + "OpenIDEA_x64.app.tar.gz", + "OpenIDEA_arm64_en-US.msi", + "OpenIDEA_arm64-setup.exe", + "OpenIDEA_x64_en-US.msi", + "OpenIDEA_x64-setup.exe", + `OpenIDEA_${version}_windows_x64_portable.zip`, + `OpenIDEA_${version}_windows_arm64_portable.zip`, + ].filter((name) => !nightly || !name.endsWith(".rpm")); + const assets = bundles.flatMap((name, id) => [ + { name, id: id * 2 }, + { name: `${name}.sig`, id: id * 2 + 1 }, + ]); + const upload = vi.fn(); + const failed = vi.fn(); + await run( + { + paginate: async () => assets, + rest: { + repos: { + listReleaseAssets: vi.fn(), + getRelease: async () => ({ data: { body: "Release notes" } }), + getReleaseAsset: async ({ asset_id }: { asset_id: number }) => ({ + data: Buffer.from(`signature-${asset_id}\n`), + }), + uploadReleaseAsset: upload, + }, }, }, - }, - { repo: { owner: "l0ng-ai", repo: "openidea" } }, - { notice: vi.fn(), info: vi.fn(), setFailed: failed }, - ); - expect(failed).not.toHaveBeenCalled(); - const manifest = JSON.parse(upload.mock.calls[0]![0].data); - for (const [arch, filename] of [ - ["x86_64", "x64"], - ["aarch64", "arm64"], - ]) { - const name = `OpenIDEA_${version}_windows_${filename}_portable.zip`; - const sig = assets.find((a) => a.name === `${name}.sig`)!; - expect(manifest.platforms[`windows-${arch}-portable`]).toEqual({ - signature: `signature-${sig.id}`, - url: `https://github.com/l0ng-ai/openidea/releases/download/${tag}/${name}`, - }); - expect(manifest.platforms[`windows-${arch}`].url).toContain("_en-US.msi"); - expect(manifest.platforms[`windows-${arch}-nsis`].url).toContain("-setup.exe"); - } -}); + { repo: { owner: "l0ng-ai", repo: "openidea" } }, + { notice: vi.fn(), info: vi.fn(), setFailed: failed }, + ); + expect(failed).not.toHaveBeenCalled(); + const manifest = JSON.parse(upload.mock.calls[0]![0].data); + for (const [arch, filename] of [ + ["x86_64", "x64"], + ["aarch64", "arm64"], + ]) { + const name = `OpenIDEA_${version}_windows_${filename}_portable.zip`; + const sig = assets.find((a) => a.name === `${name}.sig`)!; + expect(manifest.platforms[`windows-${arch}-portable`]).toEqual({ + signature: `signature-${sig.id}`, + url: `https://github.com/l0ng-ai/openidea/releases/download/${tag}/${name}`, + }); + expect(manifest.platforms[`windows-${arch}`].url).toContain("_en-US.msi"); + expect(manifest.platforms[`windows-${arch}-nsis`].url).toContain("-setup.exe"); + } + if (nightly) { + expect(manifest.platforms["linux-x86_64-rpm"]).toBeUndefined(); + expect(manifest.platforms["linux-aarch64-rpm"]).toBeUndefined(); + } else { + expect(manifest.platforms["linux-x86_64-rpm"]).toBeDefined(); + expect(manifest.platforms["linux-aarch64-rpm"]).toBeDefined(); + } + }, +);