Skip to content

Merge pull request #49 from evershalik/main #113

Merge pull request #49 from evershalik/main

Merge pull request #49 from evershalik/main #113

Workflow file for this run

name: Deploy Documentation
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build documentation
run: |
export GITHUB_ACTIONS=true
sphinx-build -c . -b dirhtml . _build/html --keep-going -w .sphinx/warnings.txt
- name: Check build warnings
run: |
if [ -f .sphinx/warnings.txt ] && [ -s .sphinx/warnings.txt ]; then
echo "::error::Sphinx build produced warnings — deployment blocked:"
cat .sphinx/warnings.txt
exit 1
fi
- name: Prepare GitHub Pages output
run: |
touch _build/html/.nojekyll
find _build/html -type f -name "index" ! -name "index.*" \
-exec sh -c 'cp "$1" "$1.html"' _ {} \;
if [ -f _build/html/404/index.html ]; then
cp _build/html/404/index.html _build/html/404.html
fi
- name: Verify build output
run: |
test -f _build/html/index.html || { echo "::error::index.html missing"; exit 1; }
test -f _build/html/.nojekyll || { echo "::error::.nojekyll missing"; exit 1; }
echo "Build output: $(find _build/html -type f | wc -l) files"
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: '_build/html'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
- name: Verify deployment
run: |
URL="https://docs.ngkorefoundation.org"
echo "Waiting for CDN to propagate new deployment at $URL"
for i in $(seq 1 10); do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$STATUS" = "200" ]; then
echo "Site is live (attempt $i)"
exit 0
fi
echo "Attempt $i: HTTP $STATUS — retrying in 15s"
sleep 15
done
echo "::warning::Site did not return 200 after 150s — CDN may still be propagating"