-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: Add documentation build workflow
Build documentation and push to gh-pages when merged to main. Signed-off-by: Jan Tore Guggedal <[email protected]>
- Loading branch information
1 parent
24026e5
commit fc35c38
Showing
3 changed files
with
77 additions
and
36 deletions.
There are no files selected for viewing
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
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 |
This file was deleted.
Oops, something went wrong.
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
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 |