diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..67d517f --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,62 @@ +name: Deploy Sphinx docs static content to GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: 3.10 + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r docs/requirements.txt . + - name: Build Sphinx Documentation + run: | + make -C docs html + rm docs/build/html/.buildinfo + + - name: Upload documentation + uses: actions/upload-artifact@v3 + with: + name: sphinx-docs + path: docs/build/html + + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + if: github.ref == 'refs/heads/main' + uses: actions/upload-pages-artifact@v1 + with: + # Upload build sphinx docs + path: 'docs/build/html' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d983dac..167007a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,7 +72,7 @@ jobs: run: | python -m pytest - package_docs: + package: needs: test runs-on: ubuntu-latest @@ -113,34 +113,7 @@ jobs: with: name: python-packages path: dist - - name: Build Sphinx Documentation - run: | - # install so that setuptools_scm generate version for package - pip install -r docs/requirements.txt -e . - make -C docs html - env: - PIP_EXTRA_INDEX_URL: https://${{secrets.ARTIFACTORY_RO_USER}}:${{secrets.ARTIFACTORY_RO_TOKEN}}@artifactory.niaid.nih.gov/artifactory/api/pypi/bcbb-pypi/simple - - name: Upload documentation - if: github.event_name == 'push' - uses: actions/upload-artifact@v3 - with: - name: sphinx-docs - path: docs/_build/html - - name: Update gh-pages - if: github.ref == 'refs/heads/master' - run: | - rm docs/_build/html/.buildinfo - touch docs/_build/html/.nojekyll - - git update-ref refs/heads/${TARGET_BRANCH} origin/${TARGET_BRANCH} - ./utils/update-gh-pages.sh docs/_build/html - - repo_uri="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" - git push $repo_uri ${TARGET_BRANCH} - env: - GITHUB_TOKEN: ${{ secrets.github_token }} - TARGET_BRANCH: 'gh-pages' publish_release: if: startsWith(github.ref, 'refs/tags/v') needs: package_docs