Deploying Astro with GitHub Actions
How lint, build, and deploy work with GitHub Pages, Netlify, or Vercel.
Every push to main can go from commit to live site without a manual deploy step. This template supports GitHub Pages, Netlify, and Vercel — pick one host (see the README Hosting options section).
What runs in CI
On every push to main, GitHub Actions:
- Lint —
astro checkandtsc --noEmit - Build —
npm run buildwithASTRO_SITEandASTRO_BASEset for your URL - Deploy — uploads
dist/to GitHub Pages when Pages is enabled
Pull requests run lint only — fast feedback without publishing.
GitHub Pages
- Go to Settings → Pages
- Set Source to GitHub Actions
- Push to
main
For a project site at https://username.github.io/repo-name/, set ASTRO_BASE=/repo-name/ when building.
Netlify or Vercel
Connect your repo to Netlify or Vercel. Both detect Astro and use npm run build → dist/. Set ASTRO_SITE to your production URL in the host’s environment variables.
netlify.toml and vercel.json are included in the template.
Verify locally first
npm ci
npm run check
npm run build
npm run preview
If CI fails, reproduce with these commands, fix, and push again. Claude can read Action logs via gh run view --log if you use the GitHub CLI.