name: Build rpi-imager Debian Package

on:
  push:
    branches:
      - qml
  pull_request:
    branches:
      - qml

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Install build dependencies
      run: |
        sudo apt update
        sudo apt install --no-install-recommends build-essential devscripts debhelper cmake git libarchive-dev libcurl4-gnutls-dev liblzma-dev \
            qtbase5-dev qtbase5-dev-tools qtdeclarative5-dev libqt5svg5-dev qttools5-dev libgnutls28-dev \
            qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-templates2 qml-module-qtquick-window2 qml-module-qtgraphicaleffects

    - name: Build Debian package
      run: |
        debuild -uc -us

    - name: Upload Debian package as artifact
      uses: actions/upload-artifact@v3
      with:
        name: retro-imager-deb
        path: ../*.deb
