Files
awesome-kubernetes/.github/workflows/06.1.main.yml

90 lines
2.3 KiB
YAML

name: 06.1. GitHub Pages Deploy
on:
push:
branches:
- master
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Build Dual Versions
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
# 1. Build V1 to a temporary staging area
- name: Build V1 Edition (Staging)
run: mkdocs build -f mkdocs.yml -d site_v1_temp/
# 2. Deploy V1 to Root (SEO) and /v1/ (Fallback)
- name: Deploy V1 to Root and Subdirectory
run: |
mkdir -p site/v1/
cp -r site_v1_temp/* site/
cp -r site_v1_temp/* site/v1/
rm -rf site_v1_temp/
# 3. Build V2 Elite Edition (/v2/)
- name: Build V2 Elite Edition
run: mkdocs build -f v2-mkdocs.yml -d site/v2/
# 4. Inject Root Redirect to V2 - Human visitors land on V2 by default
- name: Inject Root Redirect to V2
run: |
cat << 'EOF' > site/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Nubenetes Redirect</title>
<meta http-equiv="refresh" content="0; url=/v2/">
</head>
<body>
<p>Redirecting to the V2 Elite Portal. <a href="/v2/">Click here</a>.</p>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './site'
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4