name: Release On Version Tag

on:
  push:
    tags:
      - "v*"

jobs:
  build-job:
    name: Run Build ROM Workflow
    uses: ./.github/workflows/build_ci_workflow.yml
    with:
      upload-build-artifact: true

  release:
    name: Release Tagged Version
    runs-on: ubuntu-latest
    needs: build-job
    steps:
      - name: Download the build output
        uses: actions/download-artifact@v8
        with:
          name: build-out
          path: build

      - uses: softprops/action-gh-release@v2
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        with:
          files: |
            build/balatro-gba.gba
