migrated base runtime to core (#380) #395
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: docs-sched-rebuild | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Ubuntu packages | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y protobuf-compiler | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools==59.4.0 wheel tox | |
- name: Setup local branches for docs build | |
run: | | |
git branch --track main origin/main || true | |
git branch --track stable origin/stable || true | |
- name: Building docs (multiversion) | |
run: | | |
tox -e docs-multi | |
- name: Delete unnecessary files | |
run: | | |
find docs/build -name .doctrees -prune -exec rm -rf {} \; | |
find docs/build -name .buildinfo -exec rm {} \; | |
- name: Upload HTML | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-build-artifact | |
path: docs/build/html | |
if-no-files-found: error | |
retention-days: 1 | |
# Identify the dir for the HTML. | |
store-html: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "gh-pages" | |
- name: Initialize Git configuration | |
run: | | |
git config user.name docs-sched-rebuild | |
git config user.email [email protected] | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: html-build-artifact | |
- name: Copy HTML directories | |
run: | | |
ls -asl | |
for i in `ls -d *` | |
do | |
echo "Git adding ${i}" | |
git add "${i}" | |
done | |
- name: Check or create dot-no-jekyll file | |
run: | | |
if [ -f ".nojekyll" ]; then | |
echo "The dot-no-jekyll file already exists." | |
exit 0 | |
fi | |
touch .nojekyll | |
git add .nojekyll | |
- name: Check or create redirect page | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
resp=$(grep 'http-equiv="refresh"' index.html 2>/dev/null) || true | |
if [ -n "${resp}" ]; then | |
echo "The redirect file already exists." | |
exit 0 | |
fi | |
def_branch="stable" | |
html_url=$(gh api "repos/${GITHUB_REPOSITORY}/pages" --jq ".html_url") | |
cat > index.html << EOF | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Redirect to documentation</title> | |
<meta charset="utf-8"> | |
<meta http=equiv="refresh" content="3; URL="${html_url}${def_branch}/index.html" | |
<link rel="canonical" href="'${html_url}${def_branch}/index.html"> | |
<script language="javascript"> | |
function redirect() { | |
window.location.assign("${html_url}${def_branch}/index.html") | |
} | |
</script> | |
</head> | |
<body onload="redirect()"> | |
<p>Please follow the link to the <a href="${html_url}${def_branch}/index.html"> | |
${def_branch}'</a> branch documentation.</p> | |
</body> | |
</html> | |
EOF | |
git add index.html | |
- name: Commit changes to the GitHub Pages branch | |
run: | | |
git status | |
if git commit -m 'Pushing changes to GitHub Pages.'; then | |
git push -f | |
else | |
echo "Nothing changed." | |
fi |