worktree-io 0.17.6

A CLI tool to open GitHub issues as git worktree workspaces
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            artifact: worktree-linux-x86_64.tar.gz
          - os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            artifact: worktree-linux-aarch64.tar.gz
            use_cross: true
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact: worktree-macos-x86_64.tar.gz
          - os: macos-latest
            target: aarch64-apple-darwin
            artifact: worktree-macos-aarch64.tar.gz
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact: worktree-windows-x86_64.zip

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Install cross
        if: matrix.use_cross == true
        uses: taiki-e/install-action@cross

      - name: Build
        shell: bash
        env:
          CARGO_PROFILE_RELEASE_STRIP: symbols
        run: |
          if [ "${{ matrix.use_cross }}" = "true" ]; then
            cross build --release --target ${{ matrix.target }}
          else
            cargo build --release --target ${{ matrix.target }}
          fi

      - name: Package (Unix)
        if: runner.os != 'Windows'
        run: tar czf ${{ matrix.artifact }} -C target/${{ matrix.target }}/release worktree

      - name: Package (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: Compress-Archive -Path target\${{ matrix.target }}\release\worktree.exe -DestinationPath ${{ matrix.artifact }}

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.artifact }}
          path: ${{ matrix.artifact }}

  release:
    name: Create GitHub Release
    needs: build
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          merge-multiple: true

      - name: Create Release
        uses: softprops/action-gh-release@v2
        with:
          generate_release_notes: true
          files: |
            worktree-linux-x86_64.tar.gz
            worktree-linux-aarch64.tar.gz
            worktree-macos-x86_64.tar.gz
            worktree-macos-aarch64.tar.gz
            worktree-windows-x86_64.zip

  publish:
    name: Publish to crates.io
    needs: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Publish
        run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}