build-macos-x64.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: Build macOS x64
  2. on:
  3. workflow_dispatch: # 手动触发,用于单独调试
  4. workflow_call: # 被其他工作流调用
  5. jobs:
  6. build:
  7. runs-on: macos-latest
  8. steps:
  9. - name: Checkout code
  10. uses: actions/checkout@v4
  11. - name: Setup Node.js
  12. uses: actions/setup-node@v4
  13. with:
  14. node-version: '20'
  15. cache: 'npm'
  16. - name: Install Rust toolchain
  17. uses: dtolnay/rust-toolchain@stable
  18. with:
  19. targets: x86_64-apple-darwin
  20. - name: Cache Rust
  21. uses: Swatinem/rust-cache@v2
  22. with:
  23. workspaces: src-tauri -> target
  24. cache-targets: true
  25. shared-key: x86_64-apple-darwin
  26. - name: Install dependencies
  27. run: npm ci
  28. - name: Build application
  29. env:
  30. TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
  31. TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
  32. run: |
  33. chmod +x build-mac.sh
  34. if [ -f ".keys/tauri-signing.key" ]; then
  35. export TAURI_SIGNING_PRIVATE_KEY=$(cat .keys/tauri-signing.key)
  36. fi
  37. node scripts/build.js --target x86_64-apple-darwin
  38. - name: Upload artifacts
  39. uses: actions/upload-artifact@v4
  40. with:
  41. name: artifacts-mac-x64
  42. path: built/*
  43. if-no-files-found: error