From 43c3685876c87c6446e36bad3036f4d3295a187e Mon Sep 17 00:00:00 2001 From: James Tocknell Date: Thu, 11 Jul 2024 23:38:52 +1000 Subject: [PATCH] Hopefully fix API docs This should fix how tox was calling the shell script. --- .github/workflows/test-overall.yml | 1 + apidocs/upload_api_docs.sh | 34 +++++++++++++++++------------- tox.ini | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-overall.yml b/.github/workflows/test-overall.yml index 2607069..47dc72e 100644 --- a/.github/workflows/test-overall.yml +++ b/.github/workflows/test-overall.yml @@ -124,3 +124,4 @@ jobs: tox env: TOXENV: ${{ matrix.tox-env }} + UPLOAD_SCIKITS_ODES_API_DOCS: ${{ github.repository == 'bmcage/odes' && 'true' || 'false' }} diff --git a/apidocs/upload_api_docs.sh b/apidocs/upload_api_docs.sh index 382b443..8a7343c 100755 --- a/apidocs/upload_api_docs.sh +++ b/apidocs/upload_api_docs.sh @@ -2,18 +2,22 @@ set -ex -# Clone gh-pages -git clone --branch gh-pages https://github.com/bmcage/odes gh-pages -# Run rsync -branch_name="$GITHUB_REF_NAME" -rsync -av --delete "$API_DOCS_OUT_DIR" "./gh-pages/$branch_name/" -# Run docs-versions-menu -cd gh-pages -docs-versions-menu -# Commit and push -git config user.name github-actions -git config user.email github-actions@github.com -git add -A --verbose -git status -git commit --verbose -m "Auto-update from Github Actions Workflow" -m "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})" -git push --verbose --force "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/bmcage" gh-pages +if [ "true" = "$UPLOAD_SCIKITS_ODES_API_DOCS" ]; then + # Clone gh-pages + git clone --branch gh-pages https://github.com/bmcage/odes gh-pages + # Run rsync + branch_name="$GITHUB_REF_NAME" + rsync -av --delete "$API_DOCS_OUT_DIR" "./gh-pages/$branch_name/" + # Run docs-versions-menu + cd gh-pages + docs-versions-menu + # Commit and push + git config user.name github-actions + git config user.email github-actions@github.com + git add -A --verbose + git status + git commit --verbose -m "Auto-update from Github Actions Workflow" -m "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})" + git push --verbose --force "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/bmcage" gh-pages +else + echo "Skipping upload of API docs" +fi diff --git a/tox.ini b/tox.ini index 9192204..5a03e3b 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,7 @@ deps= -rapidocs/requirements.txt commands= sphinx-build -W -b html -d {envtmpdir}/doctrees . {env:API_DOCS_OUT_DIR} - upload: ./upload_api_docs.sh + ./upload_api_docs.sh changedir=apidocs [testenv:docs]