This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildspec.yml
50 lines (45 loc) · 1.49 KB
/
buildspec.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: 0.2
env:
variables:
stage: 'stg'
JWT_BUCKET: 'office-maker-account-storage-stg'
JWT_KEY: 'role/office-maker-stg-ap-northeast-1-lambdaRole/token'
parameter-store:
config_yml: 'office-maker-api-config-stg'
phases:
install:
runtime-versions:
java: openjdk8
nodejs: 8
commands:
- apt-get update && apt-get install -y lsof
- echo ${config_yml} >> config.yml
- npm i -g npm@latest
- npm ci
- cd functions/authorizer/ && npm ci && cd -
- cd functions/appsyncAuthorizer/ && npm ci && cd -
- cd common && npm ci && cd -
- npx sls dynamodb install
pre_build:
commands:
- npm run test:start
- export STAGE_NAME="test-$(date +%s)"
- export STACK_NAME="office-maker-${STAGE_NAME}"
- npx sls deploy -s ${STAGE_NAME}
build:
commands: |
OUTPUT=$(aws cloudformation describe-stacks --stack-name ${STACK_NAME} --region ap-northeast-1 | jq '.Stacks[0].Outputs') \
npm run test:integration && \
echo '*** Test succeeded ***'
if [ $? = 0 ] && [ "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/release" ]; then
echo 'Deploying to staging environment......'
./node_modules/.bin/sls deploy -s ${stage}
fi
export BUILD_STATUS="$?"
post_build:
commands:
- npm i -g ts-node && BUCKET_NAME="office-maker-storage-${STAGE_NAME}" ts-node script/deleteVersionedS3.ts
- npx sls remove -s ${STAGE_NAME} && exit ${BUILD_STATUS}
cache:
paths:
- '~/.npm/**/*'