Apply latest LDD Doc Gen Config updates #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Docs | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'docs/**' | |
- 'src/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
# Single deploy job since we're just deploying | |
deploy: | |
name: 'Build and Deploy Sphinx Docs' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
if: github.actor != 'pdsen-ci' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ADMIN_GITHUB_TOKEN || github.token }} | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
# Install Sphinx | |
pip install -r docs/requirements.txt | |
- name: Make Sphinx | |
id: make | |
run: | | |
cd docs | |
# Make the HTML docs and copy to main | |
make github | |
cd .. | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload entire repository | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
pdfgen: # job 1 | |
name: 'Build PDF' | |
runs-on: ubuntu-latest | |
if: github.actor != 'pdsen-ci' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ADMIN_GITHUB_TOKEN || github.token }} | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
# Install Sphinx | |
pip install -r docs/requirements.txt | |
# Install dependencies for PDF generation | |
sudo apt install texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra latexmk | |
- name: Generate PDF | |
id: make | |
run: | | |
cd docs | |
make latexpdf | |
cp build/latex/*.pdf . | |
- name: Push PDF to Github | |
run: | | |
git config --local user.email "pdsen-ci@jpl.nasa.gov" | |
git config --local user.name "PDSEN CI Bot" | |
git add -A ./*.pdf | |
git commit --allow-empty -m "Auto-gen PDF by PDSEN CI Bot" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.ADMIN_GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true |