name: release

on:
  workflow_dispatch:

jobs:
  release:
    name: Build on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-13, macos-14]

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: deps
        run: python -m pip install -U cibuildwheel build pip wheel setuptools

      - name: sdist
        run: python -m build --sdist --outdir package
        if: matrix.os == 'ubuntu-latest'

      - name: wheels
        run: python -m cibuildwheel --output-dir package
        env:
          CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"

      - uses: actions/upload-artifact@v4
        with:
          name: package-${{ matrix.os }}
          path: package/*

  merge:
    name: Merge Artifacts
    runs-on: ubuntu-latest
    needs:
      - release

    steps:
      - uses: actions/upload-artifact/merge@v4
        with:
          name: glcontext-3.0.0
          delete-merged: true
