-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec_backend.yml
24 lines (21 loc) · 868 Bytes
/
buildspec_backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
version: 0.2
phases:
pre_build:
commands:
- aws cloudformation validate-template --template-body file://backend.yml
build:
commands:
- |
if [[ "$BRANCH_NAME" == main* ]]; then
DEPLOY_ENV="stage";
elif [[ "$BRANCH_NAME" == feature* ]]; then
DEPLOY_ENV="dev";
else
echo "Error: BRANCH_NAME must start with 'main' or 'feature'."
exit 1;
fi
- aws cloudformation deploy --template-file backend.yml --stack-name BaseInfraStack-$DEPLOY_ENV --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --parameter-overrides Environment=$DEPLOY_ENV --no-fail-on-empty-changeset
- aws cloudformation wait stack-create-complete --stack-name BaseInfraStack-$DEPLOY_ENV
post_build:
commands:
- aws cloudformation describe-stacks --stack-name BaseInfraStack-$DEPLOY_ENV