Phase 07: Deployment
Phase 7: Deployment
Option A: Cloudflare Pages (Recommended)
Automatic deployment on every push to the hub repo.
-
Connect the hub repo to Cloudflare Pages
-
Build command:
npx antora antora-playbook.yml -
Output directory:
build/site -
Environment variable:
NODE_VERSION=18
Spoke repo pushes require a rebuild trigger. Options:
-
Webhook from spoke repo to Cloudflare Pages API
-
GitHub Action in each spoke that triggers a hub rebuild
-
Empty commit to hub:
git commit --allow-empty -m "rebuild" && git push
Option B: GitHub Pages
Add a GitHub Actions workflow to the hub repo:
File: .github/workflows/docs.yml
name: Build and Deploy Docs
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npx antora antora-playbook.yml
- uses: actions/upload-pages-artifact@v3
with:
path: build/site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
Option C: Self-Hosted nginx
# Build
npx antora antora-playbook.yml
# Copy to web root
sudo rsync -av --delete build/site/ /var/www/docs/
# nginx config
server {
listen 80;
server_name docs.internal.example.com;
root /var/www/docs;
index index.html;
}
Option D: Docker
File: Dockerfile
FROM node:20-alpine AS build
WORKDIR /app
COPY . .
RUN npx antora antora-playbook.yml
FROM nginx:alpine
COPY --from=build /app/build/site /usr/share/nginx/html
EXPOSE 80
docker build -t team-docs .
docker run -p 8080:80 team-docs