supgit 0.2.0

A simple Git CLI wrapper for common Git operations
name: Release

on:
  release:
    types: [published]

permissions:
  contents: write

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            artifact: sgit-x86_64-linux
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            artifact: sgit-x86_64-linux-musl
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
            artifact: sgit-aarch64-linux
          - target: x86_64-apple-darwin
            os: macos-latest
            artifact: sgit-x86_64-macos
          - target: aarch64-apple-darwin
            os: macos-latest
            artifact: sgit-aarch64-macos
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            artifact: sgit-x86_64-windows
    steps:
      - uses: actions/checkout@v4

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

      - name: Install cross-compilation tools
        if: matrix.target == 'x86_64-unknown-linux-musl'
        run: |
          sudo apt-get update
          sudo apt-get install -y musl-tools

      - name: Install cross-compilation tools for aarch64
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu

      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
        env:
          CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

      - name: Package (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          cd target/${{ matrix.target }}/release
          tar -czvf ${{ matrix.artifact }}.tar.gz sgit
          mv ${{ matrix.artifact }}.tar.gz ../../..

      - name: Package (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          cd target/${{ matrix.target }}/release
          7z a ../../../${{ matrix.artifact }}.zip sgit.exe

      - name: Upload release asset (Unix)
        if: matrix.os != 'windows-latest'
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.event.release.tag_name }}
          files: ${{ matrix.artifact }}.tar.gz

      - name: Upload release asset (Windows)
        if: matrix.os == 'windows-latest'
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.event.release.tag_name }}
          files: ${{ matrix.artifact }}.zip