Skip to content

Add pull request CI

Add pull request CI #1

Workflow file for this run

on:
push:
branches:
- main
paths:
- 'docs/**'
jobs:
build:
name: Deploy doc
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: actions/checkout@v4
with:
lfs: 'true'
- name: Install pip packages
working-directory: docs
run: |
pip install pip --upgrade
pip install -r requirements.txt --upgrade
- name: Build doc
working-directory: docs
run: |
make html
- name: Commit
run: |
author=$(git log -1 --pretty=format:'%an')
email=$(git log -1 --pretty=format:'%ae')
commit=$(git rev-parse --short HEAD)
mkdir /tmp/doc
rm -r docs/_build/html/_sources
cp -r docs/_build/html/* /tmp/doc
git stash --all
git fetch origin gh-pages
git checkout -b gh-pages origin/gh-pages
git rm -r . --quiet
cp -r /tmp/doc/* .
touch .nojekyll
git lfs uninstall
git add . >> /dev/null
git config --global user.name "$author"
git config --global user.email "$email"
git commit -m "deploy: $commit" --allow-empty
- name: Push to gh-pages
run: >-
git push origin gh-pages:gh-pages
- name: Clean-up
run: >-
rm -r /tmp/doc