name: release

on:
  push:
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+"
      - "[0-9]+.[0-9]+.[0-9]+"

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Create github release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ github.ref_name }}
        run: |
          gh release create "$tag" --generate-notes --draft

  docker:
    needs: [ release ]
    uses: ./.github/workflows/docker.yml
    with:
      tag: ${{ github.ref_name }}
