name: Release
on:
  push:
    tags:
      - '*'

jobs:
  build_for_release:
    uses: ./.github/workflows/build.yml
    with:
      build-configs: '"Debug", "Release"'

  release:
    runs-on: ubuntu-latest
    needs: build_for_release
    permissions:
      contents: write
    steps:
      - name: Download all workflow run artifacts
        uses: actions/download-artifact@v4

      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          draft: true
          prerelease: false
          files: "*/*Release*.img"
          fail_on_unmatched_files: true
