Merge remote-tracking branch 'origin/main' into publication #764
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: Deploy Docs | |
on: | |
push: | |
branches: [publication] | |
pull_request: | |
branches: [main] | |
paths: | |
- ".actions/assistant.py" | |
- ".github/workflows/docs-deploy.yml" | |
workflow_dispatch: {} | |
workflow_run: | |
workflows: ["Publish notebook"] | |
types: | |
- completed | |
jobs: | |
# https://github.com/marketplace/actions/deploy-to-github-pages | |
build-docs-deploy: | |
runs-on: ubuntu-20.04 | |
env: | |
PATH_DATASETS: ${{ github.workspace }}/.datasets | |
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" | |
steps: | |
- name: Checkout 🛎️ Publication | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: publication | |
lfs: true | |
- name: Checkout 🛎️ PR [debugging] | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: pip | |
- run: pip install -q py-tree | |
- name: pull notebooks from Publication | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git checkout publication | |
py-tree .notebooks/ | |
mkdir -p _notebooks | |
cp -r .notebooks/* _notebooks/ | |
git checkout ${{ github.head_ref }} | |
cp -r _notebooks/* .notebooks/ | |
- name: List notebooks | |
run: | | |
py-tree .notebooks/ | |
ls -lhR .notebooks/ | |
- name: Install dependencies | |
run: | | |
mkdir -p ${PATH_DATASETS} | |
sudo apt-get update --fix-missing | |
sudo apt-get install -y cmake pandoc | |
pip install -q -r _requirements/docs.txt -f ${TORCH_URL} | |
pip list | |
shell: bash | |
- name: Make Documentation | |
working-directory: ./_docs | |
run: make html --jobs $(nproc) | |
- name: get publication SHA | |
run: echo "PUB_SHA=$(git rev-parse publication)" >> $GITHUB_ENV | |
- name: get publication SHA | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo "PUB_SHA=${{ env.PUB_SHA }}+pr-${{ github.sha }}" >> $GITHUB_ENV | |
- name: Upload built docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-html-${{ env.PUB_SHA }} | |
path: _docs/build/html/ | |
- name: Deploy 🚀 | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: JamesIves/github-pages-deploy-action@v4.6.8 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages # The branch the action should deploy to. | |
folder: _docs/build/html # The folder the action should deploy. | |
clean: true # Automatically remove deleted files from the deploy branch | |
target-folder: docs # If you'd like to push the contents of the deployment folder into a specific directory | |
single-commit: true # you'd prefer to have a single commit on the deployment branch instead of full history |