added tiled profile #343
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: Build Documentation | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
release: | |
types: [created] | |
jobs: | |
build_docs: | |
# pull requests are a duplicate of a branch push if within the same repo. | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
name: Build documentation | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- 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@v3 | |
with: | |
fetch-depth: 0 | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
- name: Start Sirepo Docker container | |
uses: NSLS-II/start-sirepo-action@v2 | |
with: | |
docker-binary: ${{ env.DOCKER_BINARY }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Set up Python ${{ matrix.python-version }} | |
# 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 }} | |
# mamba-version: "*" | |
# channels: conda-forge | |
- name: Install documentation-building requirements with apt/dpkg | |
run: | | |
set -vxeuo pipefail | |
wget --progress=dot:giga "https://github.com/jgm/pandoc/releases/download/3.1.6.1/pandoc-3.1.6.1-1-amd64.deb" -O /tmp/pandoc.deb | |
sudo dpkg -i /tmp/pandoc.deb | |
# conda install -c conda-forge -y pandoc | |
which pandoc | |
pandoc --version | |
- name: Install documentation-building requirements with pip | |
run: | | |
set -vxeuo pipefail | |
python -m pip install --upgrade pip wheel | |
python -m pip install -v . | |
python -m pip install -r requirements-dev.txt | |
python -m pip list | |
- name: Copy databroker config file | |
run: | | |
set -vxeuo pipefail | |
mkdir -v -p ~/.config/databroker/ | |
cp -v examples/local.yml ~/.config/databroker/ | |
- name: Build Docs | |
run: | | |
set -vxeuo pipefail | |
make -C docs/ html | |
status=$? | |
echo "Sirepo ${DOCKER_BINARY} container id: ${SIREPO_DOCKER_CONTAINER_ID}" | |
${DOCKER_BINARY} logs ${SIREPO_DOCKER_CONTAINER_ID} | |
if [ $status -gt 0 ]; then | |
exit $status | |
fi | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.REPOSITORY_NAME }}-docs | |
path: docs/build/html/ | |
- name: Deploy documentation to nsls-ii.github.io | |
# if: github.repository_owner == 'NSLS-II' && github.ref_name == 'main' | |
if: github.event_name == 'release' | |
# 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 }} | |
external_repository: NSLS-II/NSLS-II.github.io | |
publish_branch: master # branch in the external repository | |
publish_dir: ./docs/build/html | |
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. |