|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Install system dependencies |
| 17 | + run: | |
| 18 | + sudo apt-get update |
| 19 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 20 | +
|
| 21 | + - name: Setup Node |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: lts/* |
| 25 | + |
| 26 | + - name: Setup pnpm |
| 27 | + uses: pnpm/action-setup@v4 |
| 28 | + with: |
| 29 | + version: latest |
| 30 | + |
| 31 | + - name: Install Rust stable |
| 32 | + uses: dtolnay/rust-toolchain@stable |
| 33 | + with: |
| 34 | + components: clippy |
| 35 | + |
| 36 | + - name: Rust cache |
| 37 | + uses: swatinem/rust-cache@v2 |
| 38 | + with: |
| 39 | + workspaces: './src-tauri -> target' |
| 40 | + |
| 41 | + - name: Install frontend dependencies |
| 42 | + run: pnpm install |
| 43 | + |
| 44 | + - name: ESLint |
| 45 | + run: pnpm lint |
| 46 | + |
| 47 | + - name: Prettier |
| 48 | + run: pnpm format --check |
| 49 | + |
| 50 | + - name: Clippy |
| 51 | + working-directory: src-tauri |
| 52 | + run: cargo clippy -- -D warnings |
| 53 | + |
| 54 | + build: |
| 55 | + needs: lint |
| 56 | + permissions: |
| 57 | + contents: write |
| 58 | + strategy: |
| 59 | + fail-fast: false |
| 60 | + matrix: |
| 61 | + include: |
| 62 | + - platform: windows-latest |
| 63 | + args: '' |
| 64 | + - platform: ubuntu-22.04 |
| 65 | + args: '' |
| 66 | + - platform: macos-latest |
| 67 | + args: '--target aarch64-apple-darwin' |
| 68 | + - platform: macos-latest |
| 69 | + args: '--target x86_64-apple-darwin' |
| 70 | + |
| 71 | + runs-on: ${{ matrix.platform }} |
| 72 | + |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Install dependencies (Linux) |
| 77 | + if: matrix.platform == 'ubuntu-22.04' |
| 78 | + run: | |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 81 | +
|
| 82 | + - name: Setup Node |
| 83 | + uses: actions/setup-node@v4 |
| 84 | + with: |
| 85 | + node-version: lts/* |
| 86 | + |
| 87 | + - name: Setup pnpm |
| 88 | + uses: pnpm/action-setup@v4 |
| 89 | + with: |
| 90 | + version: latest |
| 91 | + |
| 92 | + - name: Install Rust stable |
| 93 | + uses: dtolnay/rust-toolchain@stable |
| 94 | + with: |
| 95 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 96 | + |
| 97 | + - name: Rust cache |
| 98 | + uses: swatinem/rust-cache@v2 |
| 99 | + with: |
| 100 | + workspaces: './src-tauri -> target' |
| 101 | + |
| 102 | + - name: Install frontend dependencies |
| 103 | + run: pnpm install |
| 104 | + |
| 105 | + - name: Build |
| 106 | + uses: tauri-apps/tauri-action@v0 |
| 107 | + env: |
| 108 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 109 | + with: |
| 110 | + args: ${{ matrix.args }} |
| 111 | + |
| 112 | + - name: Upload artifacts |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: sprout-${{ matrix.platform }}${{ matrix.args && '-' || '' }}${{ matrix.args && 'intel' || '' }} |
| 116 | + path: | |
| 117 | + src-tauri/target/release/bundle/**/*.msi |
| 118 | + src-tauri/target/release/bundle/**/*.exe |
| 119 | + src-tauri/target/release/bundle/**/*.AppImage |
| 120 | + src-tauri/target/release/bundle/**/*.deb |
| 121 | + src-tauri/target/release/bundle/**/*.dmg |
| 122 | + src-tauri/target/*/release/bundle/**/*.dmg |
| 123 | + if-no-files-found: ignore |
0 commit comments