name: LibreOffice wrapper

on:
  push:
    branches: [ 'master', 'main', 'develop', 'actions_javascript' ]
    tags: [ 'v*' ]
  pull_request:
    branches: [ 'master', 'main', 'develop' ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
      with:
        submodules: recursive

    - name: Install dependencies
      shell: bash
      # use backports to get libreoffice > 7.3 on ubuntu-lastest (22.04)
      run: sudo apt-get update -y && sudo apt-get install -y -t $(lsb_release -cs)-backports libreoffice-dev

    - name: Configure CMake
      shell: bash
      run: cmake -B build -S. -DCOOLPROP_LIBREOFFICE_MODULE=ON -DLO_PROGRAM_PATH=/usr/lib/libreoffice/program -DLO_SDK_PATH=/usr/lib/libreoffice/sdk
    
    - name: Build
      shell: bash
      run: cmake --build build --target install

    - name: Archive artifacts
      uses: actions/upload-artifact@v4
      with:
          name: LibreOffice
          path: install_root/LibreOffice
