permissions:
    contents: write

on:
    push:
    pull_request:

jobs:
    ubuntu:
        strategy:
            matrix:
                xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
        runs-on: ubuntu-latest
        steps:
            - uses: X11Libre/action-build-driver/target/ubuntu@v0.3.7
              with:
                xserver-version: ${{ matrix.xserver-version }}

    freebsd:
        strategy:
            matrix:
                xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
        runs-on: ubuntu-latest
        steps:
            - uses: X11Libre/action-build-driver/target/freebsd@v0.3.7
              with:
                xserver-version: ${{ matrix.xserver-version }}

    dragonfly:
        strategy:
            matrix:
                # xlibre-xserver-25.0.x not compiling on dragonfly yet
                xserver-version: [ master, xlibre-xserver-25.1.0 ]
        runs-on: ubuntu-latest
        steps:
            - uses: X11Libre/action-build-driver/target/dragonfly@v0.3.7
              with:
                xserver-version: ${{ matrix.xserver-version }}

    netbsd:
        strategy:
            matrix:
                xserver-version: [ master, xlibre-xserver-25.1.0 ]
        runs-on: ubuntu-latest
        steps:
            - uses: X11Libre/action-build-driver/target/netbsd@v0.3.7
              with:
                xserver-version: ${{ matrix.xserver-version }}

    release-notes:
        name:    Release pushed tag
        runs-on: ubuntu-latest
        if:      ${{ startsWith(github.ref, 'refs/tags/xlibre-') }}
        needs:   [ ubuntu, freebsd, dragonfly, netbsd ]
        env:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        steps:
            - uses: X11Libre/action-build-driver/release@v0.3.7
