Skip to content

Instantly share code, notes, and snippets.

@vatsal2210
Created December 23, 2020 16:02
Show Gist options
  • Save vatsal2210/bd3ba0d6922755391d3b29201e8d7630 to your computer and use it in GitHub Desktop.
Save vatsal2210/bd3ba0d6922755391d3b29201e8d7630 to your computer and use it in GitHub Desktop.
Angular Buildspec.yml file to deploy on AWS S3 via Code Pipeline.
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
# BUILD_ENV = dev / prod (Check on Build projects ENV. section)
# BUCKET_NAME = dev.domain.com / prod.domain.com (Check on Build projects ENV. section)
# APPLICATION_NAME = If you store dist/APPLICATION_NAME then replace with the APPLICATION_NAME
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
commands:
- echo Installing source NPM dependencies...
- npm install -g @angular/[email protected]
- npm install
build:
commands:
- echo Build started for ${BUILD_ENV} on `date`
- npm run build:${BUILD_ENV}
- echo Build completed...
post_build:
commands:
- echo Pre-Build started on `date`
- aws s3 cp ./dist/APPLICATION_NAME s3://${BUCKET_NAME} --recursive --acl public-read
- echo Pre-Build completed on `date`
artifacts:
files:
- dist/APPLICATION_NAME/**/*
discard-paths: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment