build-linux.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Build Linux
  2. on:
  3. workflow_dispatch: # 手动触发,用于单独调试
  4. workflow_call: # 被其他工作流调用
  5. jobs:
  6. build:
  7. runs-on: ubuntu-22.04
  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-unknown-linux-gnu
  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-unknown-linux-gnu
  26. - name: Install Linux dependencies (cached)
  27. uses: awalsh128/cache-apt-pkgs-action@latest
  28. with:
  29. packages: libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libgtk-3-dev
  30. version: 1.0
  31. - name: Install dependencies
  32. run: npm ci
  33. - name: Build application
  34. env:
  35. TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
  36. TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
  37. run: |
  38. chmod +x build-linux.sh
  39. if [ -f ".keys/tauri-signing.key" ]; then
  40. export TAURI_SIGNING_PRIVATE_KEY=$(cat .keys/tauri-signing.key)
  41. fi
  42. node scripts/build.js --target x86_64-unknown-linux-gnu
  43. - name: Upload artifacts
  44. uses: actions/upload-artifact@v4
  45. with:
  46. name: artifacts-linux
  47. path: built/*
  48. if-no-files-found: error