fix: Ensure paired server warning is removed #28
Workflow file for this run
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 quartodoc | |
on: | |
pull_request: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' # build on version tags | |
- '!v[0-9]+.[0-9]+.[0-9]+.[0-9]+' # but not if version involves a dev component | |
- '!v[0-9]+.[0-9]+.[0-9]+.dev' # or a .dev suffix | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
docs: | |
name: "Build Docs" | |
runs-on: ubuntu-latest | |
env: | |
DOCS_SUBDIR: "" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: docs/_site | |
fetch-depth: 1 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: | | |
# Install latest quartodoc from GitHub | |
pip install -e ".[dev,test,docs]" | |
- name: Install | |
run: | | |
make install | |
# If event is not a push, inspect shinyswatch version to determine output subdir | |
# If dev version --> _site/dev, otherwise build as normal | |
- name: "[push] Set DOCS_SUBDIR" | |
if: github.event_name != 'pull_request' | |
shell: python | |
run: | | |
import os | |
import shinyswatch | |
is_dev = shinyswatch.__version__.count(".") > 2 | |
subdir = "dev" if is_dev else "" | |
env_file = os.getenv("GITHUB_ENV") | |
with open(env_file, "a") as github_env: | |
github_env.write(f"DOCS_SUBDIR={subdir}") | |
if is_dev: | |
github_env.write(f"\nDOCS_PROFILE=dev") | |
# If event is a tag, set subdir to '<tag_name>' | |
- name: "[tag] Set versioned DOCS_SUBDIR" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
run: | | |
echo "DOCS_SUBDIR=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Render quarto site | |
run: | | |
make docs-ci DOCS_SUBDIR=${{ env.DOCS_SUBDIR }} | |
- name: Commit and publish to Github Pages (on tag or push to main) | |
if: github.event_name != 'pull_request' | |
run: | | |
cd docs/_site | |
# Commit changes from this build | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add -A | |
git commit -m "Build docs from ${GITHUB_REF}" || exit 0 | |
# Rebase to include any changes pushed while building docs | |
git pull --rebase origin gh-pages | |
# Deploy site by pushing to gh-pages | |
git push origin gh-pages | |
- name: Check that README.md is up-to-date | |
run: | | |
make docs-readme | |
if git diff --name-only HEAD | grep -q 'README.md'; then | |
echo '::error file=README.md,title=README is out-of-date::README.md is out of date. Please run `make docs-readme` to update it.' | |
exit 1 | |
fi |