|
| 1 | +name: Build Tauri App |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - platform: macos-latest |
| 23 | + args: --target aarch64-apple-darwin |
| 24 | + - platform: macos-latest |
| 25 | + args: --target x86_64-apple-darwin |
| 26 | + - platform: windows-latest |
| 27 | + args: '' |
| 28 | + |
| 29 | + runs-on: ${{ matrix.platform }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Install pnpm |
| 36 | + uses: pnpm/action-setup@v4 |
| 37 | + with: |
| 38 | + version: 9 |
| 39 | + |
| 40 | + - name: Setup Node.js |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: 20 |
| 44 | + cache: 'pnpm' |
| 45 | + |
| 46 | + - name: Install Rust stable |
| 47 | + uses: dtolnay/rust-toolchain@stable |
| 48 | + with: |
| 49 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 50 | + |
| 51 | + - name: Install frontend dependencies |
| 52 | + run: pnpm install |
| 53 | + |
| 54 | + - name: Build Tauri app |
| 55 | + uses: tauri-apps/tauri-action@v0 |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + with: |
| 59 | + args: ${{ matrix.args }} |
| 60 | + |
| 61 | + - name: Upload artifacts |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: binaries-${{ matrix.platform }}${{ matrix.args && '-' }}${{ matrix.args && contains(matrix.args, 'aarch64') && 'arm64' || '' }}${{ matrix.args && contains(matrix.args, 'x86_64') && 'x64' || '' }} |
| 65 | + path: | |
| 66 | + src-tauri/target/*/release/bundle/dmg/*.dmg |
| 67 | + src-tauri/target/*/release/bundle/macos/*.app |
| 68 | + src-tauri/target/release/bundle/msi/*.msi |
| 69 | + src-tauri/target/release/bundle/nsis/*.exe |
| 70 | +
|
| 71 | + release: |
| 72 | + if: startsWith(github.ref, 'refs/tags/v') |
| 73 | + needs: build |
| 74 | + runs-on: ubuntu-latest |
| 75 | + permissions: |
| 76 | + contents: write |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Download all artifacts |
| 80 | + uses: actions/download-artifact@v4 |
| 81 | + with: |
| 82 | + path: artifacts |
| 83 | + merge-multiple: true |
| 84 | + |
| 85 | + - name: Create Release |
| 86 | + uses: softprops/action-gh-release@v2 |
| 87 | + with: |
| 88 | + files: artifacts/**/* |
| 89 | + draft: true |
| 90 | + generate_release_notes: true |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + |
0 commit comments