stargaze 0.1.0

Cache and search your GitHub stars from the terminal
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write

jobs:
  build:
    name: Build ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            ext: ''
          - target: aarch64-apple-darwin
            os: macos-latest
            ext: ''
          - target: x86_64-apple-darwin
            os: macos-latest
            ext: ''
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            ext: '.exe'
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - uses: Swatinem/rust-cache@v2

      - name: Build release
        run: cargo build --release --target ${{ matrix.target }}

      - name: Package
        shell: bash
        run: |
          cd target/${{ matrix.target }}/release
          name="stargaze-${{ github.ref_name }}-${{ matrix.target }}"
          if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
            7z a "../../../${name}.zip" "stargaze${{ matrix.ext }}"
          else
            tar czf "../../../${name}.tar.gz" "stargaze${{ matrix.ext }}"
          fi
          cd ../../..
          ls -la stargaze-*

      - uses: softprops/action-gh-release@v2
        with:
          files: |
            stargaze-*.tar.gz
            stargaze-*.zip
          generate_release_notes: true

  crates_io:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    needs: build
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --token "$CARGO_REGISTRY_TOKEN"