发布Tauri应用到macOS应用商店

首先需要有一个苹果开发者账号,并且安装了Xcode

加入Apple Developer Program 会员

创建应用

  • 登录App Store Connect

  • App => 新建App

平台选择macOS

填写应用名称

选择主要语言

选择套装ID

https://developer.apple.com/account/resources/identifiers/bundleId/add/bundle

填写SKU

选择用户访问权限

创建identifier

登录app store connect,创建identifier

https://developer.apple.com/account/resources/identifiers/list

TODO

创建Provisioning Profile

https://developer.apple.com/account/resources/profiles/list

TODO

创建 Certificates

2 Certificates:

Apple Distribution Certificate 3rd Party Mac Developer Installer Certificate

https://developer.apple.com/account/resources/certificates/list

  • Apple Distribution: YOUR COMPANY NAME (XXXXXXXXXX)
  • 3rd Party Mac Developer Installer: YOUR COMPANY NAME (XXXXXXXXXX)

变量约定

  • TEAM_ID:XXXXXXXXXX

  • APP_IDENTIFIER:com.jthinking.ollmone

TODO

创建 entitlements.plist 文件

在src-tauri目录下新建entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.application-identifier</key>
    <string>XXXXXXXXXX.com.jthinking.ollmone</string>
    <key>com.apple.developer.team-identifier</key>
    <string>XXXXXXXXXX</string>
  </dict>
</plist>

TODO

修改 tauri.conf.json

{
  "bundle": {
    "macOS": {
      "entitlements": "./entitlements.plist",
      "signingIdentity": "com.jthinking.ollmone",
      "minimumSystemVersion": "12.0"
      // ...
    },
  },
  "productName": "OllmOne",
  "version": "1.0.5",
  "identifier": "com.jthinking.ollmone",
  // ...
}

编译Tauri应用

pnpm tauri build --target universal-apple-darwin

应用签名

  • 复制签名文件到应用目录下
cp ~/Downloads/OllmOne_Provisioning_Profile.provisionprofile ./src-tauri/target/universal-apple-darwin/release/bundle/macos/OllmOne.app/Contents/embedded.provisionprofile
  • 签名应用

APPLE_DISTRIBUTION_CERT_NAME="Apple Distribution: YOUR COMPANY NAME (XXXXXXXXXX)" 3RD_PARTY_MAC_DEVELOPER_INSTALLER_CERT="3rd Party Mac Developer Installer: YOUR COMPANY NAME (XXXXXXXXXX)"

codesign --deep --force --options=runtime --sign "${APPLE_DISTRIBUTION_CERT_NAME}" --identifier com.jthinking.ollmone --timestamp --entitlements "src-tauri/entitlements.plist" "src-tauri/target/universal-apple-darwin/release/bundle/macos/OllmOne.app/Contents/MacOS/OllmOne"

构建pkg安装包

productbuild --identifier com.jthinking.ollmone --sign "${3RD_PARTY_MAC_DEVELOPER_INSTALLER_CERT}" --component src-tauri/target/universal-apple-darwin/release/bundle/macos/OllmOne.app /Applications/ OllmOne.pkg

使用Transporter上传

  • 下载Transporter

  • 上传pkg安装包

应用测试

TODO

提交审核

TODO

参考