From d683ae9a1055197366f920f1f3cd27de0f7bdc15 Mon Sep 17 00:00:00 2001 From: wgqqqqq Date: Sat, 21 Nov 2026 02:08:38 +0800 Subject: [PATCH] fix(release): verify macOS icons with the pinned package CLI --- .github/workflows/desktop-package.yml | 12 +++++++++++- scripts/macos-icon-bundle.test.mjs | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/desktop-package.yml b/.github/workflows/desktop-package.yml index c55631fb15..d29c0f52c2 100644 --- a/.github/workflows/desktop-package.yml +++ b/.github/workflows/desktop-package.yml @@ -397,9 +397,19 @@ jobs: - name: Verify native macOS icon bundling if: runner.os == 'macOS' + shell: bash env: OPENBITFUN_TEST_MACOS_BUNDLE: '1' - run: node --test scripts/macos-icon-bundle.test.mjs + WORKFLOW_SHA: ${{ github.workflow_sha }} + run: | + set -euo pipefail + # Load the verification policy from this workflow. Its relative imports, + # fixtures and installed CLIs still resolve in the release checkout. + probe="scripts/.macos-icon-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.test.mjs" + trap 'rm -f "$probe"' EXIT + git fetch --no-tags --depth=1 origin "$WORKFLOW_SHA" + git show "${WORKFLOW_SHA}:scripts/macos-icon-bundle.test.mjs" > "$probe" + node --test "$probe" - name: Build desktop app run: ${{ matrix.platform.build_command }} diff --git a/scripts/macos-icon-bundle.test.mjs b/scripts/macos-icon-bundle.test.mjs index fad03cad8b..97e8035c0a 100644 --- a/scripts/macos-icon-bundle.test.mjs +++ b/scripts/macos-icon-bundle.test.mjs @@ -1,6 +1,7 @@ import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; import { tmpdir } from 'node:os'; import { dirname, join, resolve } from 'node:path'; import test from 'node:test'; @@ -69,7 +70,10 @@ test('Windows autocrlf checkout preserves the committed macOS icon source digest test('CLI is locked and macOS overlays preserve the same dev/legacy icon', () => { for (const packagePath of ['package.json', 'OpenBitFun-Installer/package.json']) { - assert.equal(json(join(ROOT, packagePath)).devDependencies['@tauri-apps/cli'], '2.11.4'); + const manifest = join(ROOT, packagePath); + const installed = createRequire(manifest)('@tauri-apps/cli/package.json').version; + assert.equal(json(manifest).devDependencies['@tauri-apps/cli'], installed, + `${packagePath} must pin the exact Tauri CLI used by its build`); } for (const app of ['src/apps/desktop', 'OpenBitFun-Installer/src-tauri']) { const directory = join(ROOT, app);