feat(desktop): split macOS installer artifacts for independent downloads

This commit is contained in:
winewill authored and leto.w committed 2026-11-12 16:42:47 +08:00
1 parent 9812fa5854
commit d612d51b5a
14 files changed
+150 -29

No files matched your search

+4 -6
View File
@@ -18,11 +18,9 @@ export function expectDesktopArchive<S extends { uses?: string; with?: Record<st
})
const uploads = job.steps.filter(step => step.uses?.startsWith('actions/upload-artifact@'))
expect(uploads).toHaveLength(count)
for (const step of uploads) {
expect(step.with?.name).toBe('${{ env.DESKTOP_ARCHIVE_NAME }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.version }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.attempt }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).not.toContain('github.run_attempt')
}
if (count === 1) expect(uploads[0]?.with?.name).toBe('${{ env.DESKTOP_ARCHIVE_NAME }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.version }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).toContain('${{ needs.package.outputs.attempt }}')
expect(job.env.DESKTOP_ARCHIVE_NAME).not.toContain('github.run_attempt')
return uploads
}
+11 -2
View File
@@ -52,7 +52,7 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
expect(uploads[0]?.if).toBe("always() && steps.checkout.outcome == 'success'")
expect(installer.if).toBe('success()')
expect(installer.with?.path).toBe('${{ steps.archive.outputs.path }}')
expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ env.DESKTOP_ARCHIVE_NAME }}' })
expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ steps.archive.outputs.metadata-name }}' })
})
it('defaults to notarization and labels the explicit debugging option', () => {
@@ -97,7 +97,16 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => {
it('passes the same target to preparation, packaging and retention', () => {
const archive = workflow.jobs['upload-artifact']!
expectDesktopArchive(archive, 1)
const uploads = expectDesktopArchive(archive, 3)
expect(archive.steps.find(step => step.id === 'archive')?.run).toContain('archive-desktop-ci.ts --split-macos')
for (const [index, kind] of ['metadata', 'dmg', 'update'].entries()) {
expect(uploads[index]?.with).toMatchObject({
name: '${{ steps.archive.outputs.' + kind + '-name }}',
path: '${{ steps.archive.outputs.' + (kind === 'metadata' ? 'path' : kind + '-path') + ' }}',
archive: false, overwrite: true, 'if-no-files-found': 'error', 'retention-days': 14,
})
expect(uploads[index]?.if).toBe('success()')
}
const job = workflow.jobs.package!
expect(job.env.DSH_DESKTOP_TARGET_PLATFORM).toBe('darwin')
expect(job.env.DSH_DESKTOP_TARGET_ARCH).toBe(arch)