name: publish-lorikeet

on:
  push:
    tags:
      - "*"

jobs:
  build:
    runs-on: '${{ matrix.os }}'
    strategy:
      matrix:
        include:
          - os: macos-latest
            name: mac
            suffix: ''
          - os: ubuntu-latest
            suffix: ''
            name: linux
          - os: windows-latest
            suffix: .exe
            name: windows
    steps:
      - uses: actions/checkout@v4
      - uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo
      - run: cargo build --release
      - uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: target/release/lorikeet${{ matrix.suffix }}
          asset_name: lorikeet-${{ matrix.name }}${{matrix.suffix}}
          tag: ${{ github.ref }}
          overwrite: true
