name: BuildAssets

on: workflow_call

jobs:
  buildAssets:
    runs-on: ubuntu-latest
    steps:
      - name: Python Setup
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"
          architecture: x64

      - name: Install Packages (apt)
        run: |
          sudo apt update
          sudo apt install qttools5-dev-tools latexmk texlive texlive-latex-extra

      - name: Checkout Source
        uses: actions/checkout@v4

      - name: Install Packages (pip)
        run: pip install -U -r requirements.txt -r docs/requirements.txt

      - name: Build Assets
        run: |
          python pkgutils.py build-assets
          python pkgutils.py icons optional

      - name: Upload Artifacts
        uses: actions/upload-artifact@v4
        with:
          name: nw-assets
          path: |
            novelwriter/assets/manual*.pdf
            novelwriter/assets/sample.zip
            novelwriter/assets/i18n/*.qm
            novelwriter/assets/icons/*.icons
          if-no-files-found: error
          retention-days: 14
