-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcra_buildspec.yaml
44 lines (44 loc) · 1.77 KB
/
cra_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
version: 0.2
env:
shell: bash
phases:
install:
runtime-versions:
nodejs: 18
commands:
#install yarn
- echo installing yarn
- npm install --global yarn
pre_build:
on-failure: ABORT
commands:
- echo launching yarn install in $SUB_PRJ_NAME...
- cd $SUB_PRJ_NAME
- yarn install
- if [[ "$SUB_PRJ_NAME" == 'packages/pn-pa-webapp' || "$SUB_PRJ_NAME" == 'packages/pn-personafisica-webapp' || "$SUB_PRJ_NAME" == 'packages/pn-personagiuridica-webapp' ]] ; then echo Generate clients... && yarn generate ;fi
- echo Running tests.. && yarn test
build:
on-failure: ABORT
commands:
- echo building the solution...
- yarn build
post_build:
on-failure: ABORT
commands:
- echo saving commit id to file
- cd ../..
- export COMMIT_ID=$(git rev-parse --verify HEAD)
- echo $COMMIT_ID > $SUB_PRJ_NAME/build/commit_id.txt
- echo gzipping and pushing artifact to s3
- cd $SUB_PRJ_NAME/build
- tar c * | gzip | aws s3 cp - "s3://${CI_ARTIFACT_BUCKET}/${GITHUB_PRJ_NAME}/commits/${COMMIT_ID}/${PACKAGE_NAME}.tar.gz"
- |
BRANCH_NAME=$(echo $CODEBUILD_WEBHOOK_HEAD_REF | sed 's/refs\/heads\///'); export BRANCH_NAME=${BRANCH_NAME:=$GIT_DEFAULT_BRANCH}
EVENT_DETAIL="{ \"event_type\": \"BUILD_DONE\", \"project_branch\":\"${BRANCH_NAME}\",\"project_type\":\"FRONTEND\", \"project\":\"pn-frontend\", \"commit_id\": \"${CODEBUILD_RESOLVED_SOURCE_VERSION}\" }"
echo $EVENT_DETAIL | jq -R -s '[{ "DetailType": "CiEvent","EventBusName": "CiEventBus", "Source":"Builder", "Detail": . }]' > ci_event.json
cat ci_event.json
aws events put-events --entries file://ci_event.json
artifacts:
base-directory: $SUB_PRJ_NAME/build
files:
- "**/*"