Build & Deploy Doxygen Docs #6
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 | |
| - 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 | |
| run: | | |
| git clone --branch docs https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/${{ github.repository }} docs-out | |
| - name: Copy generated HTML | |
| run: | | |
| find docs-out -mindepth 1 ! -regex '^docs-out/\.git\(/.*\)?' -delete | |
| cp -R docs/html/* docs-out/ | |
| - name: Commit & Push | |
| working-directory: docs-out | |
| run: | | |
| 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 |