Skip to content

Documentation to gh-pages #80

Documentation to gh-pages

Documentation to gh-pages #80

---
name: Documentation to gh-pages
on:
schedule:
# only once every month, at the 23rd
# We can always force run this.
- cron: '37 10 23 * *'
workflow_dispatch:
jobs:
check_commit:
runs-on: ubuntu-latest
name: Checks for latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Print the latest commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: Check the latest commit is within 1 week
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="1 week" --max-count=1 ${{ github.sha }}) && echo "::set-output name=should_run::false"
build:
# check that a commit has actually been made and only run if a commit has been made within the last week
needs: check_commit
if: ${{ needs.check_commit.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
# The files submodule is required for viz documentation
submodules: true
# the files submodule uses lfs
lfs: true
fetch-tags: true
# This should generally not be required, but in the end it is just easier
- name: Ensure system dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran
- name: Setup python environment
uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: r-lib/actions/setup-pandoc@v2
- name: Install sisl + documentation dependencies
run: |
python -m pip install --progress-bar=off --upgrade pip
python -m pip install --progress-bar=off -r docs/requirements.txt
python -m pip install .[viz]
- name: Build the documentation using the sisl-files as well
run: |
cd docs
SISL_NODES_EXPORT_VIS=t SISL_FILES_TESTS=${GITHUB_WORKSPACE}/files/tests make html
rm -rf build/html/_sources
touch build/html/.nojekyll
cd ..
# Deploy to github pages
- name: Deploy to github pages
uses: JamesIves/[email protected]
with:
BRANCH: gh-pages
FOLDER: docs/build/html
GITHUB_TOKEN: ${{ github.token }}