diff --git a/.github/workflows/macos-intel-package.yml b/.github/workflows/macos-intel-package.yml index 285dd5df3c..5ba3666c5c 100644 --- a/.github/workflows/macos-intel-package.yml +++ b/.github/workflows/macos-intel-package.yml @@ -215,18 +215,8 @@ jobs: id: archive working-directory: artifact-archiver run: node --import tsx apps/desktop/scripts/archive-desktop-ci.ts --split-macos - - name: Retain package metadata - if: success() - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.metadata-name }} - path: ${{ steps.archive.outputs.path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - name: Retain DMG installer - if: success() + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} uses: actions/upload-artifact@v7.0.1 with: name: ${{ steps.archive.outputs.dmg-name }} @@ -236,7 +226,7 @@ jobs: retention-days: 14 overwrite: true - name: Retain update ZIP - if: success() + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} uses: actions/upload-artifact@v7.0.1 with: name: ${{ steps.archive.outputs.update-name }} @@ -245,3 +235,13 @@ jobs: if-no-files-found: error retention-days: 14 overwrite: true + - name: Retain package metadata + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} + uses: actions/upload-artifact@v7.0.1 + with: + name: ${{ steps.archive.outputs.metadata-name }} + path: ${{ steps.archive.outputs.metadata-path }} + archive: false + if-no-files-found: error + retention-days: 14 + overwrite: true diff --git a/.github/workflows/macos-package.yml b/.github/workflows/macos-package.yml index 1094ff4ab1..f7f0afddb9 100644 --- a/.github/workflows/macos-package.yml +++ b/.github/workflows/macos-package.yml @@ -212,18 +212,8 @@ jobs: id: archive working-directory: artifact-archiver run: node --import tsx apps/desktop/scripts/archive-desktop-ci.ts --split-macos - - name: Retain package metadata - if: success() - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.metadata-name }} - path: ${{ steps.archive.outputs.path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - name: Retain DMG installer - if: success() + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} uses: actions/upload-artifact@v7.0.1 with: name: ${{ steps.archive.outputs.dmg-name }} @@ -233,7 +223,7 @@ jobs: retention-days: 14 overwrite: true - name: Retain update ZIP - if: success() + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} uses: actions/upload-artifact@v7.0.1 with: name: ${{ steps.archive.outputs.update-name }} @@ -242,3 +232,13 @@ jobs: if-no-files-found: error retention-days: 14 overwrite: true + - name: Retain package metadata + if: ${{ !cancelled() && steps.archive.outcome == 'success' }} + uses: actions/upload-artifact@v7.0.1 + with: + name: ${{ steps.archive.outputs.metadata-name }} + path: ${{ steps.archive.outputs.metadata-path }} + archive: false + if-no-files-found: error + retention-days: 14 + overwrite: true diff --git a/apps/desktop/packaging/README.i18n.yaml b/apps/desktop/packaging/README.i18n.yaml index c2e2352165..c623d2fb8f 100644 --- a/apps/desktop/packaging/README.i18n.yaml +++ b/apps/desktop/packaging/README.i18n.yaml @@ -27,8 +27,8 @@ en: b39449c2f945cab9 zh: a742ba9efa282be8 /desktop-packaging/macos-self-hosted-packaging: - en: 2f083f7868cf2c93 - zh: 231c50b4e7e667e5 + en: b7c6668f451d2e16 + zh: d3125c2bb6cf8e7b /desktop-packaging/unsigned-windows-test-installer: en: f429bc0c280e2dfa zh: 4adbcc9e906bdf80 diff --git a/apps/desktop/packaging/README.md b/apps/desktop/packaging/README.md index b98ffcdffc..e2619f0237 100644 --- a/apps/desktop/packaging/README.md +++ b/apps/desktop/packaging/README.md @@ -129,7 +129,7 @@ Installer uploads store the already-compressed release files without ZIP recompr The [Apple Silicon workflow](../../../.github/workflows/macos-package.yml) and [Intel workflow](../../../.github/workflows/macos-intel-package.yml) produce separate arm64 and x64 packages on the Apple Silicon runner labeled `dsh-mac-package-trial`. Both share one concurrency group. The Intel workflow checks Rosetta execution before dependency installation; its selected source must include the target-aware macOS CI adapter. Both select `test` or `production` and use the existing signing, notarization and packaged-runtime checks. When the selected source's dsh ships the Computer Use bundle, each workflow builds, notarizes and stages the helper for both architectures with `scripts/cua-helper/package.ts` and `stage.ts` after the configuration check, the steps npm publication uses; `skip_notarization` does not skip the helper's notarization. A source that predates helper packaging only emits a warning, and Computer Use cannot prepare its helper in that package. DMG, update ZIP, metadata ZIP and diagnostic logs are independently downloadable and retained for 14 days without publishing a release. The three package artifacts share the prefix `macos-----` (`arch` is `arm64` or `x64`), followed by `.dmg`, `-update.zip` or `-metadata.zip`. Download only the DMG for installation. The DMG and update ZIP are byte-identical copies with download names carrying the original build identity; no additional ZIP wraps them, and local download modification times are not preserved. The metadata ZIP contains the unchanged manifest and, when present, blockmap, update YAML and release record; its manifest names refer to the original retained files. COS publication and rollout continue to use those original files on the packaging machine. The operator must verify a complete Actions run and installation on the target architecture before release qualification. The `compression_level` dropdown defaults to `3` and also offers `7`; it overrides the machine preset for this run and affects only ZIP and automatic-update downloads, not DMG. -Both macOS workflows require the repository variable `DESKTOP_PUBLISH_RUNNERS`, including test and unnotarized modes. Their independent `upload-artifact` job retains installer names with the original build attempt; if archival fails after packaging succeeds, rerun only that job. See [original-machine routing and recovery](../publishing/ci/README.md#recovery-and-records). +Both macOS workflows require the repository variable `DESKTOP_PUBLISH_RUNNERS`, including test and unnotarized modes. Their independent `upload-artifact` job retains installer names with the original build attempt. After preparation succeeds, it uploads the DMG first; failure of one upload does not skip the others unless the job is cancelled. If archival fails after packaging succeeds, rerun only that job to replace the same artifacts. See [original-machine routing and recovery](../publishing/ci/README.md#recovery-and-records). All three platform forms put source, environment, update channel, version mode, manual version, test release ID and compression level first, with matching defaults. macOS notarization and Windows signing and cache measurement options follow these common fields. diff --git a/apps/desktop/packaging/README.zh.md b/apps/desktop/packaging/README.zh.md index fbe66568b9..cc6da7e75c 100644 --- a/apps/desktop/packaging/README.zh.md +++ b/apps/desktop/packaging/README.zh.md @@ -129,7 +129,7 @@ runner 的受监督启动和恢复见 [Windows runner 机器准备](../windows-s [Apple Silicon 工作流](../../../.github/workflows/macos-package.yml)与 [Intel 工作流](../../../.github/workflows/macos-intel-package.yml)在带有 `dsh-mac-package-trial` 标签的 Apple Silicon runner 上分别生成 arm64 和 x64 安装包,两者共用一个并发组。Intel 工作流在安装依赖前检查 Rosetta 能否执行;所选源码必须包含按目标架构校验的 macOS CI 适配脚本。两者均选择 `test` 或 `production`,并复用现有签名、公证和打包运行时检查。所选源码的 dsh 随附 Computer Use 组合包时,两者都在配置检查之后用 `scripts/cua-helper/package.ts` 和 `stage.ts` 构建、公证并放入两种架构的 helper,与 npm 发布的步骤相同;`skip_notarization` 不会跳过 helper 的公证。源码早于 helper 打包支持时只输出警告,该安装包中的 Computer Use 无法准备 helper。DMG、更新 ZIP、元数据 ZIP 和诊断日志可独立下载,保留 14 天,不发布 release。三个安装包相关产物共用前缀 `macos-----`(`arch` 为 `arm64` 或 `x64`),分别追加 `.dmg`、`-update.zip` 或 `-metadata.zip`。安装时只需下载 DMG。DMG 和更新 ZIP 的字节与原件一致,下载名包含原构建身份,不再套额外 ZIP,不保留下载副本的本地修改时间。元数据 ZIP 包含未修改的 manifest,以及当前模式生成的 blockmap、更新 YAML 和发布记录;manifest 中的名称指向原始留存文件。COS 发布和 rollout 继续使用打包机器上的这些原始文件。操作人员须验收完整 Actions 运行及目标架构上的安装,才能确认可交付。`compression_level` 下拉选项默认为 `3`,也可选择 `7`;本次运行以该选项覆盖机器预设,只影响 ZIP 和自动升级下载,不影响 DMG。 -两个 macOS 工作流都要求仓库变量 `DESKTOP_PUBLISH_RUNNERS`,包括 test 和未公证模式。独立 `upload-artifact` job 的安装包名称保留原构建 attempt;打包成功但归档失败时,仅重跑该 job。参见[原机器路由与恢复](../publishing/ci/README.zh.md#recovery-and-records)。 +两个 macOS 工作流都要求仓库变量 `DESKTOP_PUBLISH_RUNNERS`,包括 test 和未公证模式。独立 `upload-artifact` job 的安装包名称保留原构建 attempt。准备成功后优先上传 DMG;除非 job 被取消,单个上传失败不会跳过其他上传。打包成功但归档失败时,仅重跑该 job,以相同名称覆盖产物。参见[原机器路由与恢复](../publishing/ci/README.zh.md#recovery-and-records)。 三个平台的表单均依次展示源码、环境、升级通道、版本模式、手动版本号、测试 release ID 和压缩等级,默认值一致。macOS 公证选项和 Windows 签名、缓存测量选项位于公共字段之后。 diff --git a/apps/desktop/publishing/ci/README.i18n.yaml b/apps/desktop/publishing/ci/README.i18n.yaml index 8a4f3036d3..132f847407 100644 --- a/apps/desktop/publishing/ci/README.i18n.yaml +++ b/apps/desktop/publishing/ci/README.i18n.yaml @@ -30,8 +30,8 @@ en: ee7a9ab8c66df979 zh: c355668bc9bdb635 /desktop-ci-publication/recovery-and-records: - en: 4e9784a7cc6c95d8 - zh: 06e683a65ccab295 + en: 8751f415f189ebf5 + zh: e51c84f7cb4f4d3f /desktop-ci-publication/restore-a-channel: en: d82e2ccf70cce397 zh: d93dcb77cc4b463e diff --git a/apps/desktop/publishing/ci/README.md b/apps/desktop/publishing/ci/README.md index ab52fc15ea..64f6c29077 100644 --- a/apps/desktop/publishing/ci/README.md +++ b/apps/desktop/publishing/ci/README.md @@ -93,7 +93,7 @@ Website upload reuses the original retained installer, hashes that installer alo ## Recovery and records -The archival job creates the Windows installer ZIP or macOS metadata ZIP in store mode with system bsdtar: `%SystemRoot%\System32\tar.exe` on Windows, or `/usr/bin/tar` on macOS. `invalid ZIP output settings` rejects a missing or malformed archive name and missing retained-directory, temporary-directory or `GITHUB_OUTPUT` settings before file verification. `desktop archival: SystemRoot is required to locate Windows bsdtar` reports a missing Windows system directory setting. `ZIP creation failed with ` identifies the failed archive tool; inspect its stderr, tool availability and free space in `RUNNER_TEMP`. +The archival job creates the Windows installer ZIP or macOS metadata ZIP in store mode with system bsdtar: `%SystemRoot%\System32\tar.exe` on Windows, or `/usr/bin/tar` on macOS. `invalid ZIP output settings` rejects a missing or malformed archive name and missing retained-directory, temporary-directory or `GITHUB_OUTPUT` settings before file verification. `desktop archival: SystemRoot is required to locate Windows bsdtar` reports a missing Windows system directory setting. `ZIP creation failed with ` identifies the failed archive tool; inspect its stderr, tool availability and free space in `RUNNER_TEMP`. `split macOS artifacts require one DMG and one update ZIP` rejects Windows input or an incomplete macOS inventory; select the original complete macOS build, and omit `--split-macos` for Windows. `desktop archival: usage` rejects unsupported arguments; use no arguments for Windows or only `--split-macos` for macOS. The packaging workflows separate `package` from `upload-artifact` (GitHub artifact archival). All packaging modes, including test and unsigned builds, require `DESKTOP_PUBLISH_RUNNERS` before packaging; it routes archival to the original machine. Rerun only `upload-artifact` after an archival failure; it verifies the original manifest and hashes without rebuilding, signing or notarizing. Packaging diagnostics are best effort and do not change package success. If an archival retry stays queued without a runner, inspect the resolved runner label and upstream package outputs before treating the runner as offline. Missing outputs require operator recovery of the original retained directory and manifest; rerunning the whole workflow rebuilds the package and is not archival-only recovery. Verify output reuse in the Actions acceptance test. diff --git a/apps/desktop/publishing/ci/README.zh.md b/apps/desktop/publishing/ci/README.zh.md index 596bc78765..26fbbe578b 100644 --- a/apps/desktop/publishing/ci/README.zh.md +++ b/apps/desktop/publishing/ci/README.zh.md @@ -93,7 +93,7 @@ Environment 审批限制此工作流,不限制同一机器账户运行的任 ## 恢复与记录 -归档 job 使用系统 bsdtar 创建 store 模式的 Windows 安装包 ZIP 或 macOS 元数据 ZIP:Windows 为 `%SystemRoot%\System32\tar.exe`,macOS 为 `/usr/bin/tar`。`invalid ZIP output settings` 表示归档名称缺失或格式非法,或保留目录、临时目录、`GITHUB_OUTPUT` 缺失,会在校验文件前拒绝。`desktop archival: SystemRoot is required to locate Windows bsdtar` 表示缺失 Windows 系统目录设置。`ZIP creation failed with ` 指明失败的归档工具;检查其 stderr、工具是否可用,以及 `RUNNER_TEMP` 剩余空间。 +归档 job 使用系统 bsdtar 创建 store 模式的 Windows 安装包 ZIP 或 macOS 元数据 ZIP:Windows 为 `%SystemRoot%\System32\tar.exe`,macOS 为 `/usr/bin/tar`。`invalid ZIP output settings` 表示归档名称缺失或格式非法,或保留目录、临时目录、`GITHUB_OUTPUT` 缺失,会在校验文件前拒绝。`desktop archival: SystemRoot is required to locate Windows bsdtar` 表示缺失 Windows 系统目录设置。`ZIP creation failed with ` 指明失败的归档工具;检查其 stderr、工具是否可用,以及 `RUNNER_TEMP` 剩余空间。`split macOS artifacts require one DMG and one update ZIP` 拒绝 Windows 输入或不完整的 macOS 清单;选择原始完整 macOS 构建,Windows 不传 `--split-macos`。`desktop archival: usage` 拒绝不支持的参数;Windows 不传参数,macOS 仅传 `--split-macos`。 打包 workflow 将 `package` 与 `upload-artifact`(GitHub 产物归档)分开。所有打包模式(包括 test 和 unsigned)都要求在打包前配置 `DESKTOP_PUBLISH_RUNNERS`,用于将归档路由到原机器。归档失败后仅重跑 `upload-artifact`;它校验原始 manifest 和 hash,不重新构建、签名或公证。打包诊断归档尽力执行,不改变构建成功状态。归档重跑若一直排队且未分配 runner,应先检查解析出的 runner 标签和上游 package 输出,不能直接认定机器离线。输出缺失时需由操作者从原留存目录和 manifest 恢复文件;重跑整个 workflow 会重新构建,不属于仅归档恢复。Actions 验收须验证输出复用。 diff --git a/apps/desktop/scripts/archive-desktop-ci.ts b/apps/desktop/scripts/archive-desktop-ci.ts index d292e7e8f7..a027a150bc 100644 --- a/apps/desktop/scripts/archive-desktop-ci.ts +++ b/apps/desktop/scripts/archive-desktop-ci.ts @@ -1,4 +1,5 @@ /** Prepare verified installer artifacts and expose their paths to Actions upload steps. */ +import { constants } from 'node:fs' import { execFileSync } from 'node:child_process' import { appendFile, copyFile, mkdtemp } from 'node:fs/promises' import { join, resolve } from 'node:path' @@ -30,7 +31,7 @@ if (process.argv[1] !== undefined && resolve(process.argv[1]) === import.meta.fi const { DESKTOP_ARCHIVE_NAME: name, DESKTOP_RETAINED_DIRECTORY: directory, RUNNER_TEMP: temp, GITHUB_OUTPUT: output } = process.env if (!name || !/^[a-zA-Z0-9][a-zA-Z0-9.+_-]*\.zip$/u.test(name) || !directory || !temp || !output) throw new Error('desktop archival: invalid ZIP output settings') const split = process.argv[2] === '--split-macos' - if (process.argv.length !== (split ? 3 : 2)) throw new Error('Usage: archive-desktop-ci.ts [--split-macos]') + if (process.argv.length !== (split ? 3 : 2)) throw new Error('desktop archival: usage: archive-desktop-ci.ts [--split-macos]') const files = await verifyDesktopArchive(process.env) const installers = split ? files.filter(file => /\.(?:dmg|zip)$/u.test(file)) : [] if (split && (installers.length !== 2 || !installers.some(file => file.endsWith('.dmg')) || !installers.some(file => file.endsWith('.zip')))) { @@ -38,14 +39,15 @@ if (process.argv[1] !== undefined && resolve(process.argv[1]) === import.meta.fi } // archive: false uses the file basename; keep it equal to the upload step's name used for overwrite deletion. const staging = await mkdtemp(join(temp, 'desktop-archive-')) + // Split downloads derive their common identity prefix from DESKTOP_ARCHIVE_NAME without .zip. const base = name.slice(0, -4) const path = join(staging, split ? `${base}-metadata.zip` : name) - const outputs = [`path=${path}`] + const outputs = [`${split ? 'metadata-path' : 'path'}=${path}`] for (const file of installers) { const kind = file.endsWith('.dmg') ? 'dmg' : 'update' const filename = `${base}${kind === 'dmg' ? '.dmg' : '-update.zip'}` const destination = join(staging, filename) - await copyFile(join(directory, file), destination) + await copyFile(join(directory, file), destination, constants.COPYFILE_FICLONE) outputs.push(`${kind}-path=${destination}`, `${kind}-name=${filename}`) } if (split) outputs.push(`metadata-name=${base}-metadata.zip`) diff --git a/apps/desktop/tests/desktop-publish-preflight.spec.ts b/apps/desktop/tests/desktop-publish-preflight.spec.ts index 8c4b8bb724..91e20a4b46 100644 --- a/apps/desktop/tests/desktop-publish-preflight.spec.ts +++ b/apps/desktop/tests/desktop-publish-preflight.spec.ts @@ -42,7 +42,7 @@ it.each([{ response: {} }, { response: [{ artifacts: [{}] }] }])('rejects invali it.each(['arm64', 'x64'])('accepts notarized split %s artifacts and ignores debugging artifacts from other attempts', (arch) => { const artifacts = ['.dmg', '-update.zip', '-metadata.zip'].flatMap(suffix => [ - { name: `macos-${arch}-notarized-1.0.0-42-2${suffix}` }, + { name: `macos-${arch}-signed-1.0.0-42-2${suffix}` }, { name: `macos-${arch}-unnotarized-debug-1.0.0-42-1${suffix}` }, { name: `macos-${arch}-unnotarized-debug-1.0.0-142-2${suffix}` }, ]) diff --git a/apps/desktop/tests/retain-desktop-ci.spec.ts b/apps/desktop/tests/retain-desktop-ci.spec.ts index dfdf5bb104..8fbd7b61a3 100644 --- a/apps/desktop/tests/retain-desktop-ci.spec.ts +++ b/apps/desktop/tests/retain-desktop-ci.spec.ts @@ -130,7 +130,7 @@ it.runIf(process.platform === 'darwin' || process.platform === 'win32').each([ ] as const)('splits %s %s installers without changing retained publication inputs', async (target, qualification) => { const { root, directory, archiveEnv, names, env } = await retainedFixture(target, qualification) const original = await verifyRetainedDesktopRelease(desktopReleasesRoot(env), '123', '2') - const base = `macos-${target.slice(4)}-${qualification}-1.0.0-123-2` + const base = `macos-${target.slice(4)}-${qualification === 'notarized' ? 'signed' : 'unnotarized-debug'}-1.0.0-123-2` for (const attempt of ['3', '4']) { const output = join(root, `archive-output-${attempt}`) execFileSync(process.execPath, ['--import', 'tsx', archiveScript, '--split-macos'], { @@ -148,7 +148,7 @@ it.runIf(process.platform === 'darwin' || process.platform === 'win32').each([ const name = names.find(file => file.endsWith(extension!))! expect(await readFile(outputs[`${kind}-path`]!)).toEqual(await readFile(join(directory, name))) } - const metadata = unzipSync(await readFile(outputs.path!)) + const metadata = unzipSync(await readFile(outputs['metadata-path']!)) expect(Object.keys(metadata)).toEqual(['manifest.json', ...names.filter(name => !/\.(?:dmg|zip)$/u.test(name))]) for (const [name, bytes] of Object.entries(metadata)) expect(Buffer.from(bytes)).toEqual(await readFile(join(directory, name))) expect(await verifyRetainedDesktopRelease(desktopReleasesRoot(env), '123', '2')).toEqual(original) @@ -169,3 +169,15 @@ it.each(['wrong-runner', 'corrupted-installer', 'windows'] as const)('emits no s : failure === 'windows' ? 'one DMG and one update ZIP' : 'changed file') await expect(readFile(output)).rejects.toMatchObject({ code: 'ENOENT' }) }) + +it('rejects unsupported archive arguments without emitting upload paths', async () => { + const { root, archiveEnv } = await retainedFixture('mac-arm64', 'notarized') + const output = join(root, 'archive-output') + const result = spawnSync(process.execPath, ['--import', 'tsx', archiveScript, '--unknown'], { encoding: 'utf8', + env: { ...process.env, ...archiveEnv, DESKTOP_ARCHIVE_NAME: 'fixture.zip', GITHUB_OUTPUT: output, RUNNER_TEMP: root } }) + expect(result.error).toBeUndefined() + expect(result.signal).toBeNull() + expect(result.status).toBe(1) + expect(result.stderr).toContain('desktop archival: usage: archive-desktop-ci.ts [--split-macos]') + await expect(readFile(output)).rejects.toMatchObject({ code: 'ENOENT' }) +}) diff --git a/scripts/desktop-archive-workflow-test.ts b/scripts/desktop-archive-workflow-test.ts index 85ede1493e..8214ff709d 100644 --- a/scripts/desktop-archive-workflow-test.ts +++ b/scripts/desktop-archive-workflow-test.ts @@ -2,7 +2,7 @@ import { expect } from 'vitest' /** - * Require archival steps to retain the original machine, directory and build identity. + * Require original-machine routing and build identity inputs; callers check each upload name. * @param job Parsed archival job from a packaging workflow. * @param count Expected number of artifact upload steps. * @returns The checked upload steps, preserving platform-specific fields. @@ -18,7 +18,6 @@ export function expectDesktopArchive step.uses?.startsWith('actions/upload-artifact@')) expect(uploads).toHaveLength(count) - 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') diff --git a/scripts/macos-package-workflow.spec.ts b/scripts/macos-package-workflow.spec.ts index 5c715e2842..7d7f3c3564 100644 --- a/scripts/macos-package-workflow.spec.ts +++ b/scripts/macos-package-workflow.spec.ts @@ -50,9 +50,9 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => { expect(archive['runs-on']).toEqual(['self-hosted', '${{ needs.package.outputs.runner }}']) const installer = archive.steps.find(step => step.uses?.startsWith('actions/upload-artifact@'))! 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: '${{ steps.archive.outputs.metadata-name }}' }) + expect(installer.if).toBe("${{ !cancelled() && steps.archive.outcome == 'success' }}") + expect(installer.with?.path).toBe('${{ steps.archive.outputs.dmg-path }}') + expect(installer.with).toMatchObject({ archive: false, overwrite: true, name: '${{ steps.archive.outputs.dmg-name }}' }) }) it('defaults to notarization and labels the explicit debugging option', () => { @@ -99,13 +99,13 @@ describe.each(['arm64', 'x64'])('macOS %s packaging', (arch) => { const archive = workflow.jobs['upload-artifact']! 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()) { + for (const [index, kind] of ['dmg', 'update', 'metadata'].entries()) { expect(uploads[index]?.with).toMatchObject({ name: '${{ steps.archive.outputs.' + kind + '-name }}', - path: '${{ steps.archive.outputs.' + (kind === 'metadata' ? 'path' : kind + '-path') + ' }}', + path: '${{ steps.archive.outputs.' + (kind + '-path') + ' }}', archive: false, overwrite: true, 'if-no-files-found': 'error', 'retention-days': 14, }) - expect(uploads[index]?.if).toBe('success()') + expect(uploads[index]?.if).toBe("${{ !cancelled() && steps.archive.outcome == 'success' }}") } const job = workflow.jobs.package! expect(job.env.DSH_DESKTOP_TARGET_PLATFORM).toBe('darwin')