feat(52-01): add publish and update-tap jobs to release workflow #6
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*' | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| args: '--target aarch64-apple-darwin' | |
| rust_target: 'aarch64-apple-darwin' | |
| - platform: 'macos-15-intel' | |
| args: '--target x86_64-apple-darwin' | |
| rust_target: 'x86_64-apple-darwin' | |
| - platform: 'ubuntu-22.04' | |
| args: '' | |
| rust_target: '' | |
| - platform: 'windows-latest' | |
| args: '' | |
| rust_target: '' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install system dependencies (Linux) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| build-essential \ | |
| curl \ | |
| wget \ | |
| file \ | |
| libxdo-dev \ | |
| libssl-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.rust_target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "src-tauri -> target" | |
| save-if: ${{ github.ref_type == 'tag' }} | |
| - uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: ${{ github.ref_name }} | |
| releaseDraft: true | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| args: ${{ matrix.args }} | |
| tauriScript: bunx tauri | |
| - name: Create portable archive (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| cd src-tauri/target/${{ matrix.rust_target }}/release/bundle/macos | |
| tar -czf trunk-macos-${{ matrix.rust_target }}.tar.gz *.app | |
| - name: Create portable archive (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cd src-tauri/target/release/bundle/appimage | |
| tar -czf trunk-linux-x86_64.tar.gz *.AppImage | |
| - name: Create portable archive (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| cd src-tauri/target/release | |
| tar -czf trunk-windows-x86_64.tar.gz trunk.exe | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: trunk-${{ matrix.platform }}-${{ matrix.rust_target || 'x64' }} | |
| path: | | |
| src-tauri/target/**/release/bundle/**/*.dmg | |
| src-tauri/target/**/release/bundle/appimage/*.AppImage | |
| src-tauri/target/**/release/bundle/**/*.msi | |
| src-tauri/target/**/release/bundle/**/*.tar.gz | |
| src-tauri/target/**/release/*.tar.gz | |
| if-no-files-found: error | |
| publish: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release edit "${{ github.ref_name }}" --draft=false --repo "${{ github.repository }}" | |
| update-tap: | |
| needs: [publish] | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.ref_name, '-') }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Get Tauri version | |
| id: tauri | |
| run: echo "version=$(jq -r .version src-tauri/tauri.conf.json)" >> "$GITHUB_OUTPUT" | |
| - name: Download DMGs and compute checksums | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| gh release download "$TAG" --pattern "*.dmg" --dir ./dmgs | |
| echo "arm_sha256=$(shasum -a 256 ./dmgs/*_aarch64.dmg | awk '{print $1}')" >> "$GITHUB_ENV" | |
| echo "intel_sha256=$(shasum -a 256 ./dmgs/*_x64.dmg | awk '{print $1}')" >> "$GITHUB_ENV" | |
| - name: Generate cask and push to tap | |
| env: | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| VERSION="${TAG#v}" | |
| TAURI_VERSION="${{ steps.tauri.outputs.version }}" | |
| git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/joaofnds/homebrew-tap.git" tap | |
| cat > tap/Casks/trunk.rb << CASK | |
| # Generated by joaofnds/trunk release workflow. DO NOT EDIT. | |
| cask "trunk" do | |
| version "${VERSION}" | |
| on_intel do | |
| sha256 "${intel_sha256}" | |
| url "https://github.com/joaofnds/trunk/releases/download/v#{version}/trunk_${TAURI_VERSION}_x64.dmg" | |
| end | |
| on_arm do | |
| sha256 "${arm_sha256}" | |
| url "https://github.com/joaofnds/trunk/releases/download/v#{version}/trunk_${TAURI_VERSION}_aarch64.dmg" | |
| end | |
| name "Trunk" | |
| desc "Desktop Git GUI" | |
| homepage "https://github.com/joaofnds/trunk" | |
| app "trunk.app" | |
| zap trash: [ | |
| "~/Library/Application Support/com.joaofnds.trunk", | |
| "~/Library/Caches/com.joaofnds.trunk", | |
| "~/Library/WebKit/com.joaofnds.trunk", | |
| ] | |
| end | |
| CASK | |
| cd tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add Casks/trunk.rb | |
| git commit -m "Update trunk to ${TAG}" | |
| git push |