Merge pull request #114 from aboutcircles/v1.0.1-patch2-upgradable-gr… #41
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: Deploy MkDocs to GitHub Pages | |
on: | |
push: | |
branches: | |
- beta | |
- candidate/stable | |
- 20241118-docs-update-beta | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
cd docs/ | |
pip install -r requirements.txt | |
- name: Build Beta Documentation | |
run: | | |
if [[ $GITHUB_REF != "refs/heads/beta" ]]; then | |
git fetch --depth 1 origin beta:beta | |
git checkout beta | |
fi | |
cd docs/ | |
mkdocs build | |
mkdir -p ../gh-pages/beta | |
cp -R site/* ../gh-pages/beta/ | |
- name: Build Candidate Stable Documentation | |
run: | | |
if [[ $GITHUB_REF != "refs/heads/candidate/stable" ]]; then | |
git fetch --depth 1 origin candidate/stable:candidate/stable | |
git checkout candidate/stable | |
fi | |
cd docs/ | |
mkdocs build | |
mkdir -p ../gh-pages/candidate-stable | |
cp -R site/* ../gh-pages/candidate-stable/ | |
- name: Create Redirect Index | |
run: | | |
cat > ./gh-pages/index.html << 'EOF' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Documentation Redirect</title> | |
<meta http-equiv="refresh" content="0; url=beta/"> | |
<style> | |
body { | |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; | |
max-width: 600px; | |
margin: 50px auto; | |
text-align: center; | |
line-height: 1.6; | |
} | |
.links { | |
margin-top: 20px; | |
} | |
a { | |
color: #0366d6; | |
text-decoration: none; | |
} | |
a:hover { | |
text-decoration: underline; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Documentation</h1> | |
<p>Redirecting to the latest beta documentation...</p> | |
<div class="links"> | |
<p>If you are not redirected, please choose a version:</p> | |
<p><a href="beta/">Beta Documentation</a> | <a href="candidate-stable/">Candidate Stable Documentation</a></p> | |
</div> | |
</body> | |
</html> | |
EOF | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./gh-pages | |
force_orphan: true |