name: Build Docs on: pull_request: paths: - 'doc/doxygen/**' - '.github/workflows/documentation-build.yml' - 'Doxyfile' release: types: - published # publishing of stable releases and pre-releases workflow_dispatch: inputs: graph_cache: description: "Use cached dot graphs? (Disabling will rebuild the GH Pages folder from scratch)" type: boolean default: true env: COCKATRICE_REF: ${{ github.ref_name }} # tag name if the commit is tagged, otherwise branch name jobs: docs: name: Doxygen runs-on: ubuntu-latest steps: - name: "Checkout source code" uses: actions/checkout@v7 with: submodules: recursive - name: "Install Graphviz" run: | sudo apt-get install -y graphviz dot -V - name: "Install Doxygen" uses: ssciwr/doxygen-install@v2 with: version: "1.16.1" - name: "Update Doxygen Configuration" run: | git diff Doxyfile doxygen -u Doxyfile if git diff --quiet Doxyfile; then echo "::notice::No config changes in Doxyfile detected." else echo "::error::Config changes in Doxyfile detected! Please update the file by running 'doxygen -u Doxyfile'." echo "" git diff --color=always Doxyfile exit 1 fi - name: "Restore graph cache from GH Pages repo" if: github.event_name != 'workflow_dispatch' || inputs.graph_cache == true continue-on-error: true uses: actions/checkout@v7 with: repository: Cockatrice/cockatrice.github.io path: doxygen-output # where GH pages root will be placed, needs to match Doxygen OUTPUT_DIRECTORY token: ${{ github.token }} sparse-checkout: | docs/**/*.md5 docs/**/*.svg # Doxygen DOT_IMAGE_FORMAT sparse-checkout-cone-mode: false - name: "Generate Documentation" if: always() run: doxygen Doxyfile - name: "Deploy to cockatrice.github.io" if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master') uses: peaceiris/actions-gh-pages@v4 with: deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }} destination_dir: docs # path where the documentation will live (https://cockatrice.github.io/docs/) external_repository: Cockatrice/cockatrice.github.io publish_branch: master publish_dir: ./doxygen-output/docs/ # needs to match Doxygen "./OUTPUT_DIRECTORY/HTML_OUTPUT/"