Fix pnpm workspace for CI cache #8
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: release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "app-v*" | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_HTTP_MULTIPLEXING: "false" | |
| CARGO_NET_RETRY: "10" | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: pnpm | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./src-tauri -> target" | |
| - name: Install frontend dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Fetch Rust dependencies | |
| shell: pwsh | |
| run: | | |
| $attempts = 5 | |
| for ($i = 1; $i -le $attempts; $i++) { | |
| cargo fetch --manifest-path src-tauri/Cargo.toml | |
| if ($LASTEXITCODE -eq 0) { | |
| exit 0 | |
| } | |
| if ($i -eq $attempts) { | |
| exit $LASTEXITCODE | |
| } | |
| $delay = 15 * $i | |
| Write-Host "cargo fetch failed; retrying in $delay seconds ($i/$attempts)" | |
| Start-Sleep -Seconds $delay | |
| } | |
| - name: Build portable executable | |
| run: pnpm tauri build --no-bundle | |
| - name: Package portable zip | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path release | |
| Copy-Item src-tauri/target/release/gammadeck.exe release/GammaDeck.exe | |
| @" | |
| GammaDeck portable build | |
| Run GammaDeck.exe directly. | |
| GammaDeck.config.json and GammaDeck.data are created beside GammaDeck.exe. | |
| Delete the whole extracted folder to remove app data. | |
| Requirement: Microsoft Edge WebView2 Runtime. Most Windows 10/11 systems already have it. | |
| If the app does not start, install WebView2 Runtime from Microsoft: | |
| https://developer.microsoft.com/en-us/microsoft-edge/webview2/ | |
| "@ | Set-Content -Encoding UTF8 release/README.txt | |
| Compress-Archive -Path release/* -DestinationPath GammaDeck-windows-x64-portable.zip -Force | |
| - name: Create draft release and upload portable zip | |
| if: startsWith(github.ref, 'refs/tags/app-v') | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| gh release view $env:TAG_NAME *> $null | |
| if ($LASTEXITCODE -ne 0) { | |
| gh release create $env:TAG_NAME --draft --title "GammaDeck $env:TAG_NAME" --notes "Portable Windows build. Download and unzip GammaDeck-windows-x64-portable.zip, then run GammaDeck.exe." | |
| } | |
| gh release upload $env:TAG_NAME GammaDeck-windows-x64-portable.zip --clobber |