我的应用程序基本上只需单击一个按钮即可运行 bash 脚本。该 bash 脚本会在所选目录中创建一些文件夹和 zip 文件。
当我在本地运行它或在本地构建它之后,这一切都工作得很好。
当我尝试将我的应用程序分发到另一台 MacBook 时,它无法运行。因此,我在 GitHub 操作中添加了签名,并成功运行了它。
但是现在单击运行脚本的按钮,整个应用程序就会关闭。
我认为它与某些权限问题有关,因为我没有权利文件。
我试图通过将其链接到我的 tauri.conf.json 文件中来添加它,如下所示:
..."macOS": {
"entitlements": "resources/entitlements.mac.plist"
}...
这也是我的 Github 操作文件:
strategy:
fail-fast: false
matrix:
platform: [macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: setup NodeJS
uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: '.nvmrc'
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: install app dependencies and build it
run: yarn && yarn build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD:
${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY:
${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tagName: ${{ github.ref_name }}
releaseName: "Synergy X ${{ github.ref_name }}"
releaseBody: See the assets to download this version and install..
releaseDraft: true
prerelease: false`
但是后来我的签名由于某种原因开始中断。
Bundling Synergy X.app (/Users/runner/work/synergy-x/synergy-x/src-tauri/target/release/bundle/macos/Synergy X.app)
Signing with identity "***"
Info setup keychain from environment variables...
Info Signing app bundle...
Signing /Users/runner/work/synergy-x/synergy-x/src-tauri/target/release/bundle/macos/Synergy X.app/Contents/MacOS/Synergy X
Info using entitlements file at resources/entitlements.mac.plist
Error failed to bundle project: failed to sign app
error Command failed with exit code 1.
info Visit ``https://yarnpkg.com/en/docs/cli/run`` for documentation about this command.
Error: Command failed with exit code 1: yarn tauri build
这是我的 entitlements.mac.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.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
</dict>
</plist>
我走在正确的轨道上吗?有人有如何签署和设置权利特权文件的示例吗?
谢谢
这是一个由两部分组成的问题。
xml 格式不正确..
我在代码中创建了日志文件,这导致了错误。
因此生产中没有日志文件。