name: "release"
on:
  push:
    branches:
      - quodlibet-*

jobs:
  create-release-artifacts:
    runs-on: ubuntu-24.04
    name: create-release-artifacts
    steps:
      - uses: actions/checkout@v4

      - name: Install Dependencies
        run: |
          sudo apt update -qq
          sudo apt install -qqy \
            libdbus-glib-1-dev \
            gettext \
            gir1.2-gst-plugins-base-1.0 \
            gir1.2-gtk-3.0 \
            gir1.2-soup-3.0 \
            gstreamer1.0-plugins-good \
            libcairo2-dev \
            libgirepository1.0-dev \
            pkg-config \
            pipx \
            xvfb
          pipx install "poetry==2.1.3"
          pipx ensurepath

      - name: Create source dist
        run: |
          poetry install
          git clean -f
          poetry run ./setup.py distcheck
          cd dist
          gz_name=(quodlibet-*.tar.gz)
          sha256sum "$gz_name" > "$gz_name.sha256"

      - name: Upload
        uses: actions/upload-artifact@v4
        with:
          path: dist/quodlibet-*
          if-no-files-found: error
