GitHub Actions Pipeline for Static Sites and Services
Build, test, and deploy — the workflow we use for this journal and our internal docs.
Push to main, site updates. No manual steps. The pattern works for static sites and container deploys alike.
Static Site Pattern
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: dist
Lessons
- Cache npm/pnpm — cold installs add 2–3 minutes
- Run build on PRs too, deploy only on merge
- Pin action versions (
@v4), not@main - Separate build and deploy jobs for clearer failure signals
ci-cd , github-actions , automation · GitHub Actions , Docker