From 4edee135c047248d12e58b51083e3dcdba8d8f53 Mon Sep 17 00:00:00 2001 From: Matthew Whitlock Date: Wed, 20 Nov 2024 13:00:25 -0500 Subject: [PATCH] Deploy docs to Github pages --- .github/scripts/build-gh-pages.sh | 46 +++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 40 +++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/scripts/build-gh-pages.sh create mode 100644 .github/workflows/docs.yml diff --git a/.github/scripts/build-gh-pages.sh b/.github/scripts/build-gh-pages.sh new file mode 100644 index 0000000..bd7e85a --- /dev/null +++ b/.github/scripts/build-gh-pages.sh @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..1f6609f --- /dev/null +++ b/.github/workflows/docs.yml @@ -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 +