-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
46 lines (45 loc) · 1.59 KB
/
Copy pathbuildspec.yml
File metadata and controls
46 lines (45 loc) · 1.59 KB
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
version: 0.2
env:
variables:
APPLICATION_NAME: "APPLICATION_NAME"
S3_BUCKET_NAME: "S3_BUCKET_NAME"
S3_PREFIX: "S3_PREFIX"
KMS_KEY: "KMS_KEY"
S3_REGION_SECONDARY: "S3_REGION_SECONDARY"
S3_BUCKET_NAME_SECONDARY: "S3_BUCKET_NAME_SECONDARY"
S3_PREFIX_SECONDARY: "S3_PREFIX_SECONDARY"
KMS_KEY_SECONDARY: "KMS_KEY_SECONDARY"
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
- find ./ -mtime +10950 -exec touch {} \;
pre_build:
commands:
- aws --version
- IMAGE_TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)"
build:
commands:
- npm run build
- find ./ -mtime +10950 -exec touch {} \;
- echo "built $APPLICATION_NAME-$IMAGE_TAG"
- find . -maxdepth 1 ! -name 'template.yml' ! -name 'dist' ! -name . -exec rm -vrf {} +
- cp -a dist/. .
- rm -rf dist
post_build:
commands:
- printf '{"tag":"%s"}' $APPLICATION_NAME-$IMAGE_TAG > build.json
- aws cloudformation package --template-file template.yml --output-template-file template-output.yml --s3-bucket $S3_BUCKET_NAME --s3-prefix $S3_PREFIX --kms-key-id $KMS_KEY
- aws cloudformation package --template-file template.yml --output-template-file template-output-secondary.yml --s3-bucket $S3_BUCKET_NAME_SECONDARY --s3-prefix $S3_PREFIX_SECONDARY --kms-key-id $KMS_KEY_SECONDARY --region $S3_REGION_SECONDARY
artifacts:
secondary-artifacts:
primary:
files:
- build.json
- template-output.yml
secondary:
files:
- build.json
- template-output-secondary.yml