提交记录修改scripts/prepare-release-assets.mjs+4 −2看文件
修改scripts/prepare-release-assets.test.mjs+8 −3看文件
修改www/scripts/sync-release.mjs+2 −0看文件
修改www/scripts/sync-release.test.mjs+1 −1看文件
| @@ -33,7 +33,9 @@ async function releaseNames() { | ||
| 33 | 33 | macSource: `mihomo-${macCore}-source.tar.gz`, |
| 34 | 34 | windowsSource: `mihomo-${dependencies.mihomo.version}-source.tar.gz`, |
| 35 | 35 | qemuPrefix: `qemu-${dependencies.qemu.version}-windows-full-source.`, |
| 36 | 删除: qemuSource: dependencies.qemuSource?.file, | |
| 36 | 新增: qemuSource: `${dependencies.qemuSource.file}.gz`, | |
| 37 | 新增: qemuKeymap: `qemu-keycodemapdb-${dependencies.qemuKeycodemap.version}-source.tar.gz`, | |
| 38 | 新增: qemuChanges: `qemu-${dependencies.qemu.version}-cage-changes-source.tar.gz`, | |
| 37 | 39 | }; |
| 38 | 40 | } |
| 39 | 41 | |
| @@ -119,7 +121,7 @@ export async function prepareReleaseAssets({ inputs, output }) { | ||
| 119 | 121 | } |
| 120 | 122 | for (const [name, digest] of entries) { |
| 121 | 123 | const installer = name === names.mac || name === names.windows || name === names.linux; |
| 122 | 删除: if (!installer && name !== names.macSource && name !== names.windowsSource && name !== names.linuxSource && name !== names.qemuSource && !isQemuArchive(name, names)) { | |
| 124 | 新增: if (!installer && ![names.macSource, names.windowsSource, names.linuxSource, names.qemuSource, names.qemuKeymap, names.qemuChanges].includes(name) && !isQemuArchive(name, names)) { | |
| 123 | 125 | throw new Error(`Unsupported asset or version in SHA256SUMS: ${name}`); |
| 124 | 126 | } |
| 125 | 127 | const existing = all.get(name); |
| @@ -51,11 +51,16 @@ test('includes Linux deb only with its verified corresponding source and merges | ||
| 51 | 51 | |
| 52 | 52 | test('combines both platforms, deduplicates identical sources and keeps website checksum lookup valid', async t => { |
| 53 | 53 | const f = await fixture(t); |
| 54 | 删除: const extraSource = dependencies.qemuSource.file; | |
| 54 | 新增: const extraSource = `${dependencies.qemuSource.file}.gz`; | |
| 55 | 新增: const packagedSources = { | |
| 56 | 新增: [extraSource]: 'QEMU repository source fixture', | |
| 57 | 新增: [`qemu-keycodemapdb-${dependencies.qemuKeycodemap.version}-source.tar.gz`]: 'keymap source fixture', | |
| 58 | 新增: [`qemu-${dependencies.qemu.version}-cage-changes-source.tar.gz`]: 'Cage QEMU patch fixture', | |
| 59 | 新增: }; | |
| 55 | 60 | await platform(f.mac, macAssets()); |
| 56 | 删除: await platform(f.windows, { ...windowsAssets(), [extraSource]: 'patched QEMU source fixture' }); | |
| 61 | 新增: await platform(f.windows, { ...windowsAssets(), ...packagedSources }); | |
| 57 | 62 | const result = await prepareReleaseAssets({ inputs: [f.mac, f.windows], output: f.output }); |
| 58 | 删除: const expected = new Map(Object.entries({ ...macAssets(), ...windowsAssets(), [extraSource]: 'patched QEMU source fixture' })); | |
| 63 | 新增: const expected = new Map(Object.entries({ ...macAssets(), ...windowsAssets(), ...packagedSources })); | |
| 59 | 64 | assert.deepEqual(new Set(await readdir(f.output)), new Set([...expected.keys(), 'SHA256SUMS'])); |
| 60 | 65 | assert.equal(result.version, version); |
| 61 | 66 | const sums = await readFile(join(f.output, 'SHA256SUMS'), 'utf8'); |
| @@ -13,6 +13,8 @@ const repoURL = `https://github.com/${repository}`; | ||
| 13 | 13 | const apiURL = `https://api.github.com/repos/${repository}/releases`; |
| 14 | 14 | const sourceArchive = name => /^mihomo-v[\d.]+-source\.tar\.gz$/.test(name) || |
| 15 | 15 | /^qemu-[0-9a-f]{40}-source\.tar\.gz$/.test(name) || |
| 16 | 新增: /^qemu-keycodemapdb-[0-9a-f]{40}-source\.tar\.gz$/.test(name) || | |
| 17 | 新增: /^qemu-\d+\.\d+\.\d+-cage-changes-source\.tar\.gz$/.test(name) || | |
| 16 | 18 | /^qemu-\d+\.\d+\.\d+-windows-full-source\.(?:tar\.)?(?:gz|xz|bz2|zst|zip|7z|tar)$/.test(name); |
| 17 | 19 | |
| 18 | 20 | export async function request(url, timeout = 180_000, { fetchImpl = fetch } = {}) { |
| @@ -198,7 +198,7 @@ test('macOS verification checks both owned archives without requiring other-plat | ||
| 198 | 198 | |
| 199 | 199 | test('explicit RC manifest exposes signed Windows and all platforms with complete QEMU sources', async () => { |
| 200 | 200 | const tag = 'v0.1.7-rc.1', version = tag.slice(1); |
| 201 | 删除: const names = [`Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, `Cage-${version}-linux-amd64.deb`, 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz']; | |
| 201 | 新增: const names = [`Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, `Cage-${version}-linux-amd64.deb`, 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz', `qemu-${'a'.repeat(40)}-source.tar.gz`, `qemu-keycodemapdb-${'b'.repeat(40)}-source.tar.gz`, 'qemu-11.1.0-cage-changes-source.tar.gz']; | |
| 202 | 202 | const manifest = names.map(name => `${hash} ${name}\n`).join(''); |
| 203 | 203 | const release = await publicManifestRelease(tag, async (url, options = {}) => { |
| 204 | 204 | assert.equal(options.headers?.Authorization, undefined); |

