rabbitsay 0.1.0

Say (possibly mean) things with a cute rabbit
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: Build binaries
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
            name: link-shortener-${{ github.ref_name }}-linux-x64.tar.gz
          - target: x86_64-apple-darwin
            os: macos-13  # Intel Mac
            name: link-shortener-${{ github.ref_name }}-macos-x64.tar.gz
          - target: aarch64-apple-darwin
            os: macos-14  # Apple Silicon Mac
            name: link-shortener-${{ github.ref_name }}-macos-arm64.tar.gz
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            name: link-shortener-${{ github.ref_name }}-windows-x64.zip
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}

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

      - name: Strip binary (Unix)
        if: matrix.os != 'windows-latest'
        run: strip target/${{ matrix.target }}/release/link-shortener

      - name: Create archive (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          cd target/${{ matrix.target }}/release
          tar -czf ../../../${{ matrix.name }} link-shortener

      - name: Create archive (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          cd target/${{ matrix.target }}/release
          Compress-Archive -Path link-shortener.exe -DestinationPath ../../../${{ matrix.name }}

      - name: Upload to GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          files: ${{ matrix.name }}
          generate_release_notes: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}