From 1a2ef06ca289cc8a9b2ffc78cb95574190d46c13 Mon Sep 17 00:00:00 2001 From: leeguooooo Date: Sun, 8 Nov 2026 22:23:41 +0900 Subject: [PATCH 1/2] =?UTF-8?q?ci:=20=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20macOS=20Universal=20dmg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 57 ++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ce0f54..5883b09 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,10 +170,65 @@ jobs: path: artifacts/* if-no-files-found: error + # ================= macOS:Universal(Apple Silicon + Intel)dmg ================= + macos: + name: macOS (universal dmg) + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: 版本号对齐 tag + id: ver + shell: bash + run: | + if [[ "$GITHUB_REF" == refs/tags/v* ]]; then + V="${GITHUB_REF_NAME#v}" + else + V="$(node -p "require('./src-tauri/tauri.conf.json').version")" + fi + echo "version=$V" >> "$GITHUB_OUTPUT" + node -e "const fs=require('fs');for(const p of ['src-tauri/tauri.conf.json','package.json']){const j=JSON.parse(fs.readFileSync(p));j.version=process.argv[1];fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')}" "$V" + + - uses: pnpm/action-setup@v4 + with: + version: 10 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-apple-darwin,x86_64-apple-darwin + - uses: swatinem/rust-cache@v2 + with: + workspaces: src-tauri -> target + key: macos + + - run: pnpm install --frozen-lockfile + + # 打包目标(app + dmg)取自 src-tauri/tauri.macos.conf.json;未配置开发者证书,产物为 ad-hoc 签名 + - name: 构建(Universal dmg) + run: pnpm tauri build --target universal-apple-darwin + + - name: 收集产物 + shell: bash + run: | + set -euo pipefail + mkdir -p artifacts + cp src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg \ + "artifacts/HGhub_${{ steps.ver.outputs.version }}_universal.dmg" + ls -lh artifacts + + - uses: actions/upload-artifact@v4 + with: + name: macos + path: artifacts/* + if-no-files-found: error + # ================= 发布 ================= release: name: Publish GitHub Release - needs: [windows, android] + needs: [windows, android, macos] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: From fd54081d305d7d974775a62b9bdbaf25d59dbfcd Mon Sep 17 00:00:00 2001 From: leeguooooo Date: Sun, 8 Nov 2026 22:32:26 +0900 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=20macOS=20?= =?UTF-8?q?=E6=9C=AA=E7=AD=BE=E5=90=8D=E5=8C=85=E7=9A=84=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index ab624b9..9372c6d 100644 --- a/README.md +++ b/README.md @@ -147,5 +147,14 @@ cd src-tauri/gen/android 需要设置 `ANDROID_HOME`(Android SDK 根目录)、`NDK_HOME`(`$ANDROID_HOME/ndk/<版本>`)与 `JAVA_HOME`(JDK 17)。 +**4. macOS 打开时提示「已损坏」或「无法验证开发者」** + +Release 里的 dmg 没有用 Apple 开发者证书签名和公证,从网上下载后会被 Gatekeeper 拦下。 +把 HGhub 拖进「应用程序」后,在终端执行一次: + +```bash +xattr -cr /Applications/HGhub.app +``` + ## LinuxDO https://linux.do/