Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/bundle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Copy existing PDFs from docs/end-user-docs
- name: Copy existing PDFs from docs/end_user_docs
run: |
echo "Copying existing PDFs from docs/end-user-docs/source..."
cp docs/end-user-docs/*.pdf bundle/docs/ 2>/dev/null || echo "No PDFs found in source directory"
echo "Copying existing PDFs from docs/end_user_docs/source..."
cp docs/end_user_docs/*.pdf bundle/docs/ 2>/dev/null || echo "No PDFs found in source directory"
echo "PDFs copied to bundle/docs:"
ls -lh bundle/docs/

Expand Down
129 changes: 64 additions & 65 deletions .github/workflows/generate-latex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@ name: Generate LaTeX Documentation

on:
workflow_dispatch: # Manual trigger
workflow_run: # Auto-trigger when release.yml completes
workflows: ["Automated release workflow"]
types:
- completed
release: # Trigger on manual release creation
types: [created, published]

permissions:
contents: write

env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_REPO_URL: ${{ secrets.SVN_REPO_URL }}

jobs:
generate-latex:
build-pdf:
runs-on: ubuntu-latest
permissions:
contents: read # ← unprivileged - only read access needed for build
# Only run if triggered by workflow_dispatch, release, pull_request, or if workflow_run completed successfully
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'release' ||
github.event_name == 'pull_request' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
github.event_name == 'release'

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref }}
ref: ${{ github.event_name == 'workflow_run' && github.event.repository.default_branch || github.ref }}

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: '3.11'

Expand All @@ -45,7 +33,7 @@ jobs:
pandoc --version

- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 #v7
with:
enable-cache: true
cache-dependency-glob: uv.lock
Expand All @@ -55,51 +43,59 @@ jobs:
uv lock --check || uv lock

- name: Install Dependencies
run: uv sync --group dev --group docs
run: uv sync --group dev --group docs # NOSONAR

- name: list env contents
run: |
uv pip list

- name: Install Subversion
run: |
sudo apt-get update
sudo apt-get install -y subversion
- name: Checkout Deltares LaTeX styles from internal GitHub repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
repository: Deltares/LatexInstallation
token: ${{ secrets.LATEX_REP_TOKEN }}
path: temp_latex
ref: main

- name: Checkout Deltares LaTeX styles from SVN
- name: Copy Deltares LaTeX styles to source directory
run: |
cd docs/end-user-docs

# Checkout SVN repository with error handling
if ! svn checkout --username "${{ secrets.SVN_USERNAME }}" --password "${{ secrets.SVN_PASSWORD }}" --non-interactive --trust-server-cert "${{ secrets.SVN_REPO_URL }}" temp_svn; then
echo "::error::Failed to checkout SVN repository"
exit 1
fi
cd docs/end_user_docs

# List available directories for debugging
echo "Available LaTeX directories in SVN:"
ls -la temp_svn/templates/latex/tex/latex/ || echo "Directory structure different than expected"
echo "Available LaTeX directories in GitHub repo:"
ls -la ../../temp_latex/MiKTeX/tex/latex/ || echo "Directory structure different than expected"

# Copy Deltares styles with error handling
if [ -d "temp_svn/templates/latex/tex/latex/deltares" ]; then
cp -r temp_svn/templates/latex/tex/latex/deltares/* source/ || echo "::warning::Failed to copy deltares styles"
if [ -d "../../temp_latex/MiKTeX/tex/latex/deltares" ]; then
cp -r ../../temp_latex/MiKTeX/tex/latex/deltares/* source/
echo "✓ Copied deltares styles"
else
echo "::warning::deltares styles directory not found"
fi

if [ -d "temp_svn/templates/latex/tex/latex/nomentbl/deltares" ]; then
cp -r temp_svn/templates/latex/tex/latex/nomentbl/deltares/* source/ || echo "::warning::Failed to copy nomentbl styles"
if [ -d "../../temp_latex/MiKTeX/tex/latex/nomentbl/deltares" ]; then
cp -r ../../temp_latex/MiKTeX/tex/latex/nomentbl/deltares/* source/
echo "✓ Copied nomentbl styles"
else
echo "::warning::nomentbl styles directory not found"
fi

if [ -d "temp_svn/templates/latex/bibtex/bst/deltares" ]; then
cp -r temp_svn/templates/latex/bibtex/bst/deltares/* source/ || echo "::warning::Failed to copy bibtex styles"
if [ -d "../../temp_latex/MiKTeX/bibtex/bst/deltares/" ]; then
cp -r ../../temp_latex/MiKTeX/bibtex/bst/deltares/* source/
echo "✓ Copied bibtex styles"
else
echo "::warning::bibtex styles directory not found"
fi

rm -rf temp_svn

- name: Generate LaTeX from Markdown (user_docs)
run: |
uv run ddocs markdown-to-latex \
--input docs/mkdocs/user_docs \
--output docs/end-user-docs/source
.venv/bin/ddocs markdown-to-latex \
--input docs/user_docs \
--output docs/end_user_docs/source

- name: Generate LaTeX from Markdown (changelog)
run: |
.venv/bin/pandoc -o docs/end_user_docs/source/changelog.tex docs/CHANGELOG.md

- name: Install LaTeX
run: |
Expand All @@ -114,37 +110,40 @@ jobs:

pdflatex --version

- name: Compile PDF with pdflatex and bibtex
- name: Make build script executable
run: chmod +x docs/end_user_docs/build_pdf.sh

- name: Build PDF documentation with version
run: |
cd docs/end-user-docs/source
pdflatex fm2prof_user_manual.tex
pdflatex fm2prof-release-notes.tex
# Run bibtex if citations exist, otherwise skip
if grep -q '\\citation' fm2prof_user_manual.aux 2>/dev/null; then
bibtex fm2prof_user_manual
bibtex fm2prof-release-notes
else
echo "No citations found, skipping bibtex"
fi
pdflatex fm2prof_user_manual.tex
pdflatex fm2prof-release-notes.tex
pdflatex fm2prof_user_manual.tex
pdflatex fm2prof-release-notes.tex
cd docs/end_user_docs
./build_pdf.sh

- name: List generated files
run: |
echo "Generated LaTeX files:"
find docs/end-user-docs/source -name "*.tex" -type f
find docs/end_user_docs/source -name "*.tex" -type f
echo ""
echo "Generated PDF files:"
find docs/end-user-docs/source -name "*.pdf" -type f
find docs/end_user_docs/source -name "*.pdf" -type f

- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: Documentations
path: docs/end-user-docs/source/*.pdf
path: docs/end_user_docs/source/*.pdf
retention-days: 3

upload_to_release:
runs-on: ubuntu-latest
needs: build-pdf
permissions:
contents: write # priviliged, has write access.
steps:
- name: Download PDF artifact
uses: actions/download-artifact@v4
with:
name: Documentations
path: pdfs/
- name: Get release tag
id: get_tag
if: github.event_name == 'release' || github.event_name == 'workflow_run'
Expand All @@ -165,6 +164,6 @@ jobs:
with:
tag_name: ${{ steps.get_tag.outputs.tag }}
files: |
docs/end-user-docs/source/*.pdf
docs/end_user_docs/source/*.pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/tests/test_data/compare1d2d/rijn-j22_6-v1a2/output/**
testIni.ini
*_cache.json
# notebooks
**.ipynb_checkpoints**
# pixi environments
.pixi/*
!.pixi/config.toml
File renamed without changes.
Loading
Loading