| name: Publish documentation | |
| # publish the documentation on every merge to develop branch | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| paths: | |
| - docs/mkdocs/** | |
| # the site also embeds these files via pymdownx.snippets | |
| # (mkdocs.yml sets restrict_base_path: false for this) | |
| - .clang-tidy | |
| - .github/CODE_OF_CONDUCT.md | |
| - .github/CONTRIBUTING.md | |
| - .github/SECURITY.md | |
| - cmake/clang_flags.cmake | |
| - cmake/gcc_flags.cmake | |
| - include/nlohmann/detail/abi_macros.hpp | |
| - tests/fmt_formatter/project/main.cpp | |
| - tools/astyle/.astylerc | |
| workflow_dispatch: | |
| # we don't want to have concurrent jobs, and we don't want to cancel running jobs to avoid broken publications | |
| concurrency: | |
| group: documentation | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish_documentation: | |
| permissions: | |
| contents: write | |
| if: github.repository == 'nlohmann/json' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| # the git-revision-date-localized plugin needs the history for correct "last update" dates and so the | |
| # strict build does not fail on a shallow clone | |
| fetch-depth: 0 | |
| - name: Install virtual environment | |
| run: make install_venv -C docs/mkdocs | |
| - name: Build documentation | |
| run: make build -C docs/mkdocs | |
| - name: Deploy documentation | |
| uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/mkdocs/site |