Release #43
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: | |
| inputs: | |
| tag: | |
| description: 'Tag to build (e.g., v0.101.0)' | |
| required: true | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_id: ${{ steps.create.outputs.id }} | |
| tag: ${{ github.event.inputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag }} | |
| - name: Extract release notes from CHANGELOG | |
| id: notes | |
| run: | | |
| VERSION="${{ github.event.inputs.tag }}" | |
| VERSION_NUM="${VERSION#v}" | |
| # Extract from CHANGELOG.md | |
| NOTES=$(awk -v ver="$VERSION_NUM" ' | |
| /^## / { if (found) exit; if ($2 == ver) { found=1; next } } | |
| found { print } | |
| ' CHANGELOG.md) | |
| # Fallback if no notes found | |
| if [ -z "$NOTES" ]; then | |
| NOTES="Release $VERSION" | |
| fi | |
| # Output using heredoc for multiline | |
| echo 'notes<<EOF' >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo 'EOF' >> $GITHUB_OUTPUT | |
| - name: Create draft release | |
| id: create | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag }} | |
| draft: true | |
| body: ${{ steps.notes.outputs.notes }} | |
| build: | |
| name: Build (${{ matrix.target }}) | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| target: x86_64-unknown-linux-gnu | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag }} | |
| - name: Install Linux dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libappindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: src-tauri | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| env: | |
| HUSKY: 0 | |
| - name: Build with Tauri | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HUSKY: 0 | |
| with: | |
| releaseId: ${{ needs.create-release.outputs.release_id }} | |
| args: --target ${{ matrix.target }} | |
| publish-release: | |
| needs: [create-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release edit "${{ needs.create-release.outputs.tag }}" \ | |
| --repo ${{ github.repository }} \ | |
| --draft=false |