Skip to content

Instantly share code, notes, and snippets.

@jinnatul
Created June 19, 2025 15:36
Show Gist options
  • Select an option

  • Save jinnatul/34ade5ec538be108fc124f3f0a29cf3b to your computer and use it in GitHub Desktop.

Select an option

Save jinnatul/34ade5ec538be108fc124f3f0a29cf3b to your computer and use it in GitHub Desktop.
Deploy multiple branches in AWS Amplify using different build commands.
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- if [ "${AWS_BRANCH}" = "main" ]; then npm run build:prod; fi
- if [ "${AWS_BRANCH}" = "develop" ]; then npm run build:dev; fi
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- node_modules/**/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment