Skip to content

Migrate Docs to Sphinx-Design, Remove NPS, Update Workflows (#109) #248

Migrate Docs to Sphinx-Design, Remove NPS, Update Workflows (#109)

Migrate Docs to Sphinx-Design, Remove NPS, Update Workflows (#109) #248

Workflow file for this run

# Build documentation
name: Build and upload documentation
defaults:
run:
shell: bash
on: # Runs on any push event in a PR or any push event to master
pull_request:
push:
branches:
- 'master'
jobs:
documentation:
runs-on: ubuntu-latest
env:
python-version: 3.12
steps:
- uses: actions/checkout@v4
- name: Update apt
run: sudo apt-get update
- name: Install LaTeX
run: sudo apt-get install -y texlive-latex-base texlive-latex-extra texlive-fonts-recommended # texlive-fonts-extra texlive-latex-recommended ghostscript
- name: Install optipng, dvipng and cm-super
run: sudo apt-get install -y optipng dvipng cm-super
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
- name: Upgrade pip, setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install package with doc dependencies
run: python -m pip install ".[docs]"
- name: Get acc-models-lhc
run: git clone -b 2022 https://gitlab.cern.ch/acc-models/acc-models-lhc.git --depth 1
- name: Move acc-models-lhc to examples folder
run: mv acc-models-lhc examples/
- name: Build documentation
continue-on-error: true
run: make docs
# Upload artifacts if in PR so reviewers can have a quick look without building documentation from the branch locally
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success() && github.event_name == 'pull_request' # only for pushes in PR
with:
name: site-build
path: doc_build
retention-days: 5
# Upload the doc to github pages branch and publish if from a push to master
- name: Upload documentation to gh-pages
if: success() && github.ref == 'refs/heads/master' # only for pushes to master
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: doc_build