name: Build Binaries

on:
  workflow_dispatch:
    inputs:
      tag:
        description: Release tag (e.g. v0.1.1)
        required: true
        type: string

permissions:
  contents: write

jobs:
  upload:
    name: Upload ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-apple-darwin
            os: macos-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ inputs.tag }}

      - uses: taiki-e/upload-rust-binary-action@v1
        with:
          bin: dublette
          target: ${{ matrix.target }}
          ref: refs/tags/${{ inputs.tag }}
          checksum: sha256
          token: ${{ secrets.GITHUB_TOKEN }}
