Skip to content

DOC improve doc building speed? #478

DOC improve doc building speed?

DOC improve doc building speed? #478

Workflow file for this run

name: Deploy GitHub pages
on:
release:
types: [created]
pull_request:
push:
branches: master
env:
DOC_REPO: alphacsc/alphacsc.github.io
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache documentation
if: github.ref_type != 'tag'
uses: actions/cache@v3
env:
cache-name: cache-documentation
with:
path: |
doc/_build/
doc/auto_examples
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Generate HTML docs
uses: ax3l/sphinx-action@newer-sphinx
env:
ALLOW: --allow-run-as-root
with:
docs-folder: "doc/"
pre-build-command: |
apt-get update
apt-get install -y gcc git libopenmpi-dev openmpi-bin
python -m pip install --upgrade pip
python -m pip install -e .[doc,dicodile]
- name: Upload generated HTML as artifact
uses: actions/upload-artifact@v2
with:
name: DocHTML
path: doc/_build/html/
deploy_docs:
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag'
needs:
build_docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: DocHTML
path: doc/_build/html/
- name: Commit to documentation repo
run: |
git clone https://github.com/$DOC_REPO.git --branch master --single-branch gh-pages
# copy documentation to dev directory
# when it is not a tag or a it is a tag but release candidate
if [ ${{github.ref_type}} != 'tag' ] || [[ ${{github.ref_name}} =~ "rc" ]]; then
rm -Rf gh-pages/dev
cp -a doc/_build/html/ gh-pages/dev
fi;
# if release:
# rename current stable directory with the version in version.txt
# copy documentation under stable directory
# update version.txt with current version
if [ ${{github.ref_type}} == 'tag' ] && [[ ! ${{github.ref_name}} =~ "rc" ]]; then
mv gh-pages/stable gh-pages/$(cat gh-pages/version.txt)
cp -a doc/_build/html/ gh-pages/stable
echo ${{github.ref_name}} > gh-pages/version.txt
fi;
cd gh-pages
git config --local user.email "alphacsc@github.com"
git config --local user.name "alphacsc GitHub Action"
git add .
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
repository: ${{ env.DOC_REPO }}
branch: master
directory: gh-pages
github_token: ${{ secrets.DEPLOY_PAGES }}