Build & Deploy Doxygen Docs #17
This file contains hidden or 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
name: "Build & Deploy Doxygen Docs" | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [closed] | |
branches: | |
- develop | |
jobs: | |
build-and-deploy: | |
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Install Doxygen | |
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz | |
- name: Generate Doxygen HTML | |
run: doxygen ./Doxyfile | |
- name: Clone docs branch into docs-out/ | |
run: | | |
git clone --branch docs https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/${{ github.repository }} docs-out | |
- name: Copy generated HTML into docs-out/ | |
run: | | |
rm -rf docs-out/* | |
cp -R docs/html/* docs-out/ | |
- name: Commit and push to docs branch | |
run: | | |
cd docs-out | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Regenerate Doxygen docs from ${{ github.sha }}" || echo "No changes to commit" | |
git push --force https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/${{ github.repository }}.git HEAD:docs |