Merge pull request #124 from yusufuyanik1/master #122
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: Build & Deploy docs | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- python/** | |
- .github/workflows/** | |
- examples/** | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
name: Build & Deploy docs | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install dependencies | |
working-directory: python | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r docs/docs-requirements.txt | |
sudo apt-get update | |
sudo apt-get install -y pandoc | |
sudo apt install -y graphviz | |
- name: Build Python documentation | |
working-directory: python/docs | |
run: make html | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages | |
cp -r python/docs/build/html/* gh-pages/Python/ | |
cp -r r/docs/* gh-pages/R/ | |
cd gh-pages | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# the return code. | |
- name: Push changes to gh-pages branch | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |