-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yaml
48 lines (43 loc) · 1.7 KB
/
buildspec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
version: 0.2
env:
variables:
S3_BUCKET: "angular-sandbox-20xx"
APP_NAME: "sandbox"
BUILD_ENV : "prod"
phases:
install:
commands:
# Download and Install NodeJS 8.0
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- sudo apt-get install -y nodejs
- echo Installing source NPM dependencies...
# Install http drivers for node
- sudo apt-get update -y
- sudo apt-get install -y apt-transport-https
# Install Yarn Package Manager (Replace the commands below if you using NPM).
# - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# - sudo apt-get update -y
# - sudo apt-get install -y yarn
# Install Angular CLI, If you are not using Angular 6, install angular/[email protected] or lower, confirm by running ng -v inside your project folder
- npm install -g @angular/[email protected]
# Install node dependancies.
- npm install
build:
commands:
# Builds Angular application. You can also build using custom environment here like mock or staging
- echo "Build started on date"
- ng build --${BUILD_ENV}
post_build:
commands:
# Clear S3 bucket.
- aws s3 rm s3://angular-sandbox-20xx/* --recursive
- echo S3 bucket is cleared.
# Copy dist folder to S3 bucket, As of Angular 6, builds are stored inside an app folder in distribution and not at the root of the dist folder
- aws s3 cp dist/sandbox s3://angular-sandbox-20xx/ --recursive
- echo Build completed on `date`
artifacts:
files:
- '**/*'
discard-paths: yes
base-directory: 'dist*'