Skip to content

Scaffold Astro

From an empty working directory (or into the existing amplify-astro-cicd clone):

Terminal window
npm create astro@latest amplify-astro-cicd -- --template minimal --install --no-git --typescript strict
cd amplify-astro-cicd

Keep the site minimal: one page is enough. The goal is CI/CD, not content design.

Confirm a local build:

Terminal window
npm run build
ls dist

Create amplify.yml
Root amplify.yml file that tells Amplify how to install, build, and which artifact directory to publish.
at the repository root:

version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
- |
if [ "${AWS_BRANCH}" != "main" ]; then
printf 'User-agent: *\nDisallow: /\n' > dist/robots.txt
fi
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*

Notes:

  • AWS_BRANCH is set by Amplify (main, staging, or a PR branch name)
  • Non-main builds write a disallow-all robots.txt so previews and staging are less likely to be indexed
  • Artifacts come from dist/ only - do not publish node_modules

Full reference: amplify.yml.

# amplify-astro-cicd
Minimal Astro site for Amplify staging PR previews and GitHub CI

Next: GitHub branches and CI.