Skip to content

Commit

Permalink
workflows: Add documentation build workflow
Browse files Browse the repository at this point in the history
Build documentation and push to gh-pages when merged to main.

Signed-off-by: Jan Tore Guggedal <[email protected]>
  • Loading branch information
jtguggedal committed Dec 2, 2024
1 parent 24026e5 commit fc35c38
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 36 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/docs-build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Documentation Build

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- '.github/workflows/docs-build-and-publish.yml'
- 'docs/**'
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip
- name: Install Python dependencies
working-directory: docs
run: |
python3 -m pip install -r requirements.txt
- name: Build documentation
working-directory: docs
run: |
sphinx-build -M html . build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: doc-build
if-no-files-found: error
retention-days: 2
path: |
docs/build/html/
- name: Update gh-pages
if: ${{ github.event_name == 'push' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory "$(pwd)"
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git pull origin gh-pages
# Update docs
rm -rf docs/html
mkdir docs/html
cp docs/build/html docs/html
rm -rf docs/build
# Create commit with doc updates
git add docs/html
git commit -m "Updating documentation based on ${{ github.sha }}"
# Push changes
git push origin gh-pages:gh-pages
35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

7 changes: 6 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
Sphinx
Sphinx==5.3.0
breathe==4.35.0
sphinx-ncs-theme<=0.7.4
sphinx-tabs>=3.4
sphinx-togglebutton>=0.3.2
Pillow>=9.0.1

0 comments on commit fc35c38

Please sign in to comment.