-
Notifications
You must be signed in to change notification settings - Fork 0
/
amplify.yml
43 lines (42 loc) · 1.92 KB
/
amplify.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
version: 1
backend:
phases:
preBuild:
commands:
- yum -y install jq
- npm install -g aws-cdk
- cd cdk
- npm ci
- cd ..
build:
commands:
- '# only init the environment so that we may export the infrastructure and deploy it via CDK'
- '# use backend env arn or user branch and finally aws branch'
- |
if [ -n "${AWS_BACKEND_ENVIRONMENT_ARN}" ]; then
ENV="${AWS_BACKEND_ENVIRONMENT_ARN##*/}"
elif [ -n "${USER_BRANCH}" ]; then
ENV="${USER_BRANCH}"
else
ENV="${AWS_BRANCH}"
fi
export ENV
if [ "$REMOTE_BACKEND_EXISTS" = "false" ]; then
amplify init --amplify "{\"envName\":\"${ENV}\",\"appId\":\"${AWS_APP_ID}\"}" --providers "{\"awscloudformation\":{\"configLevel\":\"project\",\"useProfile\":true,\"profileName\":\"default\"}}" --codegen "{\"generateCode\":false,\"generateDocs\":false}" --yes;
else
amplify pull --amplify "{\"envName\":\"${ENV}\",\"appId\":\"${AWS_APP_ID}\"}" --providers "{\"awscloudformation\":{\"configLevel\":\"project\",\"useProfile\":true,\"profileName\":\"default\"}}" --no-override --no-codegen --yes && amplify init --amplify "{\"envName\":\"${ENV}\",\"appId\":\"${AWS_APP_ID}\"}" --providers "{\"awscloudformation\":{\"configLevel\":\"project\",\"useProfile\":true,\"profileName\":\"default\"}}" --codegen "{\"generateCode\":false,\"generateDocs\":false}" --yes;
fi
- npm run deploy
- projectName=$(jq -r '.artifacts."exported-amplify-backend-stack".properties.stackName' cdk/cdk.out/manifest.json)
- amplify export pull --rootStackName "${projectName}" --out out --frontend javascript
frontend:
phases:
build:
commands: []
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: /out
files:
- '**/*'
cache:
paths: []