Build #34
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| bundle: dmg | |
| suffix: "" | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| bundle: dmg | |
| suffix: "-intel" | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| bundle: deb | |
| suffix: "" | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| bundle: nsis | |
| suffix: ".exe" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install Linux deps | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev librsvg2-dev \ | |
| patchelf libssl-dev libgtk-3-dev libayatana-appindicator3-dev | |
| - name: Install NSIS (Windows) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: choco install nsis -y --no-progress | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| src-tauri/target/release/build | |
| src-tauri/target/release/.fingerprint | |
| src-tauri/target/release/deps | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| - name: Build | |
| shell: bash | |
| run: npm run tauri build -- --bundles ${{ matrix.bundle }} | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BuffBrain-${{ matrix.target }}${{ matrix.suffix }} | |
| path: | | |
| src-tauri/target/release/bundle/${{ matrix.bundle }}/ | |
| src-tauri/target/release/buffbrain${{ matrix.suffix }} | |
| release: | |
| permissions: | |
| contents: write | |
| if: github.event_name == 'release' | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List extracted installers | |
| run: find artifacts -type f | sort | |
| - name: Upload release assets | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| find artifacts -type f \( -name "*.dmg" -o -name "*.deb" -o -name "*.exe" \) | while IFS= read -r file; do | |
| echo "Uploading $file" | |
| gh release upload "${{ github.event.release.tag_name }}" "$file" --clobber | |
| done |