Skip to content

Try quoting env vars in sphinx-build call #33

Try quoting env vars in sphinx-build call

Try quoting env vars in sphinx-build call #33

Workflow file for this run

name: add_tagged_docs
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
add_tagged_docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Remove the prefix "refs/*/" from $GITHUB_REF
# Add var assignment to the $GITHUB_ENV file, so VERSION_TAG is available in later steps
- name: Set VERSION_TAG env var ⚙️
run: echo "VERSION_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Eyeball VERSION_TAG env var 👀
run: |
echo $VERSION_TAG
echo ${{ env.VERSION_TAG }}
- name: Eyeball Git config 👀
run: git config --list
- name: Check out VERSION_TAG 🛒
uses: actions/checkout@v3
with:
ref: ${{ env.VERSION_TAG }}
- name: Check out a new branch 🛒
run: |
branch_name="auto_add_tagged_docs_$VERSION_TAG"
git checkout -b $branch_name
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
- name: Set up Python 🐍
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry 📜
run: pip install poetry
- name: Eyeball native environment 👀
run: python --version ; pip --version ; poetry --version ; pwd ; ls -la
- name: Install package dependencies 📜
run: poetry install
- name: Install docs dependencies 📜
run: poetry run pip install -r docs/requirements.txt
- name: Build HTML with config overrides 🏗️
run: |
cd docs/
poetry run sphinx-build -vvv -M html source build -D release="$VERSION_TAG" -D version="$VERSION_TAG" -D html_extra_path=__ignore -D html_theme_options.switcher.version_match="$VERSION_TAG"
- name: Move built HTML to source extra dir 🏗️
run: |
mkdir -p docs/source/extra/$VERSION_TAG
mv docs/build/html/* docs/source/extra/$VERSION_TAG/
- name: Eyeball the Git status 👀
run: git status -u
- name: Configure Git user ⚙️
run: |
git config --global user.email "[email protected]"
git config --global user.name "_"
- name: Add and commit all changes to the new branch ➕
run: |
git add .
git commit -m "Add documentation for $VERSION_TAG"
- name: Push new branch upstream 🚀
run: git push --set-upstream origin "$BRANCH_NAME"
env:
GH_PR: ${{ secrets.GH_PR }}
# Note: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.
- name: Create pull request 🦟
run: gh pr create -B main -H "$BRANCH_NAME" --title "Merge $BRANCH_NAME into main" --body 'Automated pull request from GitHub Actions workflow. **Note, you will still need to update `docs/source/extra/switcher.json` accordingly.**'
env:
GH_TOKEN: ${{ secrets.GH_PR }}