Merge pull request #389 from JunAishima/enable-ispyb-dev #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish documentation | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish_docs: | |
name: Build and publish documentation | |
if: github.repository_owner == 'NSLS-II' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: Set env vars | |
run: | | |
export REPOSITORY_NAME=${GITHUB_REPOSITORY#*/} # just the repo, as opposed to org/repo | |
echo "REPOSITORY_NAME=${REPOSITORY_NAME}" >> $GITHUB_ENV | |
export DOCKER_BINARY="docker" | |
echo "DOCKER_BINARY=${DOCKER_BINARY}" >> $GITHUB_ENV | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} with conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: ${{ env.REPOSITORY_NAME }}-py${{ matrix.python-version }} | |
auto-update-conda: true | |
miniconda-version: "latest" | |
python-version: ${{ matrix.python-version }} | |
- name: Install documentation-building requirements | |
run: | | |
set -vxeo pipefail | |
pip install -r requirements-dev.txt | |
pip list | |
- name: Build Docs | |
run: | | |
set -vxeuo pipefail | |
make -C docs/ html | |
status=$? | |
if [ $status -gt 0 ]; then | |
exit $status | |
fi | |
- name: Deploy documentation to nsls-ii.github.io | |
# We pin to the SHA, not the tag, for security reasons. | |
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions | |
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }} | |
publish_branch: master | |
publish_dir: ./docs/build/html | |
external_repository: NSLS-II/NSLS-II.github.io | |
destination_dir: ${{ env.REPOSITORY_NAME }} # just the repo name, without the "NSLS-II/" | |
keep_files: true # Keep old files. | |
force_orphan: false # Keep git history. |