|
| 1 | +name: Open With Browser Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version (semver) to build (optional override for prerelease)' |
| 11 | + required: false |
| 12 | + prerelease: |
| 13 | + description: 'Mark GitHub Release as pre-release' |
| 14 | + type: boolean |
| 15 | + required: false |
| 16 | + default: false |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + name: Build (${{ matrix.platform }}) |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - os: ubuntu-latest |
| 27 | + platform: linux |
| 28 | + target: '' |
| 29 | + - os: windows-latest |
| 30 | + platform: windows |
| 31 | + target: '' |
| 32 | + - os: macos-latest |
| 33 | + platform: macos |
| 34 | + target: '' |
| 35 | + env: |
| 36 | + TAURI_SKIP_UPDATE_CHECK: 'true' |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
| 42 | + |
| 43 | + - name: Setup Bun |
| 44 | + uses: oven-sh/setup-bun@v1 |
| 45 | + with: |
| 46 | + bun-version: latest |
| 47 | + |
| 48 | + - name: Install Rust toolchain |
| 49 | + uses: dtolnay/rust-toolchain@stable |
| 50 | + |
| 51 | + - name: Cache Rust |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: | |
| 55 | + ~/.cargo/registry |
| 56 | + ~/.cargo/git |
| 57 | + target |
| 58 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 59 | + restore-keys: ${{ runner.os }}-cargo- |
| 60 | + |
| 61 | + - name: Install Linux system deps (Tauri) |
| 62 | + if: matrix.platform == 'linux' |
| 63 | + run: | |
| 64 | + sudo apt-get update |
| 65 | + sudo apt-get install -y \ |
| 66 | + libglib2.0-dev \ |
| 67 | + libgtk-3-dev \ |
| 68 | + libwebkit2gtk-4.1-dev \ |
| 69 | + librsvg2-dev \ |
| 70 | + patchelf \ |
| 71 | + libasound2-dev \ |
| 72 | + libx11-dev \ |
| 73 | + libxdo-dev \ |
| 74 | + pkg-config \ |
| 75 | + libssl-dev \ |
| 76 | + libayatana-appindicator3-dev |
| 77 | + pkg-config --libs --cflags glib-2.0 || true |
| 78 | +
|
| 79 | + - name: Install frontend dependencies |
| 80 | + working-directory: apps/desktop |
| 81 | + run: bun install --frozen-lockfile |
| 82 | + |
| 83 | + - name: Build Tauri App |
| 84 | + working-directory: apps/desktop |
| 85 | + run: bun run tauri build |
| 86 | + |
| 87 | + - name: Collect Artifacts (Linux) |
| 88 | + if: matrix.platform == 'linux' |
| 89 | + run: | |
| 90 | + mkdir -p artifacts |
| 91 | + ls -R src-tauri/target/release/bundle |
| 92 | + cp -v src-tauri/target/release/bundle/appimage/*.AppImage artifacts/ 2>/dev/null || echo 'no appimage' |
| 93 | + cp -v src-tauri/target/release/bundle/deb/*.deb artifacts/ 2>/dev/null || echo 'no deb' |
| 94 | + cp -v src-tauri/target/release/bundle/rpm/*.rpm artifacts/ 2>/dev/null || echo 'no rpm' |
| 95 | + cp -v src-tauri/target/release/bundle/msi/*.msi artifacts/ 2>/dev/null || echo 'no msi (expected)' |
| 96 | + working-directory: apps/desktop |
| 97 | + |
| 98 | + - name: Collect Artifacts (Windows) |
| 99 | + if: matrix.platform == 'windows' |
| 100 | + shell: pwsh |
| 101 | + run: | |
| 102 | + New-Item -ItemType Directory -Force -Path artifacts | Out-Null |
| 103 | + Get-ChildItem src-tauri/target/release/bundle -Recurse |
| 104 | + Copy-Item src-tauri/target/release/bundle/msi/*.msi artifacts -ErrorAction SilentlyContinue |
| 105 | + Copy-Item src-tauri/target/release/bundle/nsis/*.* artifacts -ErrorAction SilentlyContinue |
| 106 | + working-directory: apps/desktop |
| 107 | + |
| 108 | + - name: Collect Artifacts (macOS) |
| 109 | + if: matrix.platform == 'macos' |
| 110 | + run: | |
| 111 | + mkdir -p artifacts |
| 112 | + ls -R src-tauri/target/release/bundle |
| 113 | + cp -v src-tauri/target/release/bundle/dmg/*.dmg artifacts/ 2>/dev/null || echo 'no dmg yet' |
| 114 | + cp -v src-tauri/target/release/bundle/macos/*.app.tar.gz artifacts/ 2>/dev/null || echo 'no app tar' |
| 115 | + working-directory: apps/desktop |
| 116 | + |
| 117 | + - name: Upload Artifact |
| 118 | + uses: actions/upload-artifact@v4 |
| 119 | + with: |
| 120 | + name: open-with-browser-${{ matrix.platform }} |
| 121 | + path: apps/desktop/artifacts |
| 122 | + if-no-files-found: warn |
| 123 | + |
| 124 | + release: |
| 125 | + name: Create GitHub Release |
| 126 | + needs: build |
| 127 | + runs-on: ubuntu-latest |
| 128 | + permissions: |
| 129 | + contents: write |
| 130 | + steps: |
| 131 | + - name: Determine version |
| 132 | + id: ver |
| 133 | + run: | |
| 134 | + if [ -n "${{ github.event.inputs.version }}" ]; then |
| 135 | + echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT |
| 136 | + else |
| 137 | + ref="${GITHUB_REF##*/}" |
| 138 | + echo "version=${ref}" >> $GITHUB_OUTPUT |
| 139 | + fi |
| 140 | +
|
| 141 | + - name: Download Artifacts |
| 142 | + uses: actions/download-artifact@v4 |
| 143 | + with: |
| 144 | + path: dist-artifacts |
| 145 | + |
| 146 | + - name: Release |
| 147 | + uses: softprops/action-gh-release@v2 |
| 148 | + with: |
| 149 | + tag_name: ${{ steps.ver.outputs.version }} |
| 150 | + name: Open With Browser ${{ steps.ver.outputs.version }} |
| 151 | + prerelease: ${{ github.event.inputs.prerelease == 'true' || contains(steps.ver.outputs.version, '-rc') }} |
| 152 | + draft: false |
| 153 | + generate_release_notes: true |
| 154 | + files: | |
| 155 | + dist-artifacts/** |
| 156 | + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' |
0 commit comments