diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 020819c..335f7a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,10 @@ jobs: shell: bash run: ./run_tests.py + - name: Generate Documentation + shell: bash + run: ./gen_docs.sh + deploy-docs: needs: [main] if: ${{ github.event_name == 'push' && github.repository_owner == 'linqs' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} diff --git a/gen_docs.sh b/gen_docs.sh index 1f03738..7eb8487 100755 --- a/gen_docs.sh +++ b/gen_docs.sh @@ -1,7 +1,30 @@ #!/bin/bash -readonly THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# Create HTML documentation for the current code. -trap exit SIGINT +readonly THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd | xargs realpath)" -pdoc3 --config show_inherited_members=True --html --force pacai +function main() { + if [[ $# -gt 1 ]]; then + echo "USAGE: $0 [out dir]" + exit 1 + fi + + set -e + trap exit SIGINT + + local outputDir="${THIS_DIR}/html" + if [[ $# -gt 0 ]]; then + outputDir=$1 + fi + + cd "${THIS_DIR}" + + mkdir -p "${outputDir}" + + pdoc3 --config show_inherited_members=True --html --force --output-dir "${outputDir}" pacai + + return 0 +} + +[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "$@"