Release #7
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: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| args: '--target aarch64-apple-darwin' | |
| - platform: 'macos-latest' | |
| args: '--target x86_64-apple-darwin' | |
| - platform: 'ubuntu-22.04' | |
| args: '' | |
| - platform: 'windows-latest' | |
| args: '' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| package-lock.json | |
| web/package-lock.json | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Rust cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './src-tauri -> target' | |
| - name: Install root dependencies | |
| run: npm install | |
| - name: Install frontend dependencies | |
| run: npm install | |
| working-directory: web | |
| - name: Build the app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'Claude Code Usage Tracker v__VERSION__' | |
| releaseBody: 'See the assets to download this version and install.' | |
| releaseDraft: true | |
| prerelease: false | |
| args: ${{ matrix.args }} | |
| # Upload portable/green version | |
| - name: Prepare portable version (Windows) | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| $version = "${{ github.ref_name }}".TrimStart('v') | |
| $exePath = "src-tauri/target/release/claude-code-usage-tracker.exe" | |
| $newName = "Claude-Code-Usage-Tracker_${version}_windows_portable.exe" | |
| if (Test-Path $exePath) { | |
| Copy-Item $exePath $newName | |
| echo "PORTABLE_FILE=$newName" >> $env:GITHUB_ENV | |
| } | |
| shell: pwsh | |
| - name: Prepare portable version (Linux) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| version="${{ github.ref_name }}" | |
| version="${version#v}" | |
| appimage=$(find src-tauri/target/release/bundle/appimage -name "*.AppImage" 2>/dev/null | head -1) | |
| if [ -n "$appimage" ]; then | |
| new_name="Claude-Code-Usage-Tracker_${version}_linux_portable.AppImage" | |
| cp "$appimage" "$new_name" | |
| echo "PORTABLE_FILE=$new_name" >> $GITHUB_ENV | |
| fi | |
| - name: Upload portable version | |
| if: env.PORTABLE_FILE != '' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: true | |
| files: ${{ env.PORTABLE_FILE }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |