Skip to content

Commit

Permalink
Deploy docs to Github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Whitlock committed Nov 20, 2024
1 parent eeb81ee commit 4edee13
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/scripts/build-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

set -e
apt-get update >/dev/null
apt-get install -y git cmake doxygen graphviz >/dev/null

#List of branches to build docs for
#TODO: Remove doxygen branch once tested
BRANCHES="doxygen master develop"

build-docs() (
git checkout $1

#The CMake Doxygen stuff is weird, and doesn't
#properly clean up and/or overwrite old outputs.
#So to make sure we get the correct doc configs,
#we need to delete everything
#We put the docs themselves into a hidden directory
#so they don't get included in this glob
rm -rf ./*

cmake ../ -DBUILD_DOCS=ON -DDOCS_ONLY=ON \
-DFENIX_DOCS_MAN=OFF -DFENIX_BRANCH=$1 \
-DFENIX_DOCS_OUTPUT=$PWD/.docs
make doc
)

git clone https://www.github.com/sandialabs/Fenix.git
mkdir Fenix/build
cd Fenix/build

for branch in $BRANCHES; do
echo "Building docs for $branch"

#TODO: Fail if any branch fails to build,
# once the develop and master branches have doxygen
# merged in
build-docs $branch || true

echo
echo
done

if [ -n "$GITHUB_ENV" ]; then
echo "DOCS_DIR=$PWD/.docs" >> $GITHUB_ENV
fi
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish GH Pages

on:
push:
branches:
- master
- develop
- doxygen # TODO: Remove after testing

#Only one of this workflow runs at a time
concurrency:
group: docs
cancel-in-progress: true

jobs:
build-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build pages
run: /bin/bash .github/scripts/build-gh-pages.sh

- name: Upload documentation artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.DOCS_DIR }}

deploy-docs:
needs: build-pages
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write

steps:
- name: Deploy documentation to GH Pages
uses: actions/deploy-pages@v4

0 comments on commit 4edee13

Please sign in to comment.