name: Release
on:
  workflow_dispatch:
    inputs:
      version:
        description: "Version"
        required: true
        default: "v0.0.0"

jobs:
  release:
    runs-on: macos-latest # TODO: if we use ubuntu, the cross-built won't work in docker

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-go@v5
        with:
          go-version: 1.18

      - name: release
        run: |
          go generate
          git config user.name github-actions
          git config user.email github-actions@github.com
          git add *.go
          git commit -a -m build
          git tag ${{ github.event.inputs.version }}
          git push origin main ${{ github.event.inputs.version }}

      - name: commit hash
        run: git rev-parse HEAD
