Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates GitHub Action workflow for building docs #44

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 32 additions & 35 deletions .github/workflows/sphinx_build.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
name: Docs
name: Build and Deploy Docs

on:
on:
push:
branches:
- master
pull_request:
branches:
- master
- main

permissions: write-all

jobs:
build:
deploy_docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
# Standard drop-in approach that should work for most people.
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed for tag/version

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install package
shell: bash -l {0}
working-directory: docs
run: |
python -m pip install -r requirements.txt

- name: Build Documentation
shell: bash -l {0}
working-directory: docs
run: |
cd docs
make html

# Publish built docs to gh-pages branch.
# ===============================
- name: Commit documentation changes
run: |
git clone https://github.com/WelbornGroup/ELECTRIC --branch gh-pages --single-branch gh-pages
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config --local user.email "action@github.com"
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
# that.
# Push if this is a push to master.
- name: Push changes
if: ${{ github.event_name == 'push' }}
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.PUSH_DOCS }}
# ===============================
- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html
branch: gh-pages
Loading