-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
26 lines (25 loc) · 1.2 KB
/
deploy.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
version: 0.2
env:
shell: bash
secrets-manager:
SLACK_WEBHOOKURL: "slack:k12stream"
phases:
build:
commands:
- pip install git+https://github.com/openstax/raise-mbtools@9515a3f
- html-to-json html json
- aws s3 cp --cache-control no-cache --recursive json/ "s3://$CONTENT_S3_BUCKET/contents/raise/latest/"
- export VERSION=${COMMIT_ID:0:8}
- if [[ $(aws s3api list-objects-v2 --bucket "$CONTENT_S3_BUCKET" --prefix "contents/raise/$VERSION/" --max-items 0 --output json | jq 'has("Contents")') = "true" ]]; then false; fi
- aws s3 cp --cache-control max-age=86400 --recursive json/ "s3://$CONTENT_S3_BUCKET/contents/raise/$VERSION/"
on-failure: ABORT
finally:
- "if [[ $CODEBUILD_BUILD_SUCCEEDING != 1 ]]; then curl -X POST -H 'Content-type: application/json' --data '{\"text\":\"Error in k12-contents-raise pipeline!\"}' $SLACK_WEBHOOKURL; fi"
post_build:
commands:
- ls json/ > json_files.txt
- export SLACK_MESSAGE="k12-contents-raise deployment completed for commit $COMMIT_ID"
- "curl -X POST -H 'Content-type: application/json' --data '{\"text\":\"'\"$SLACK_MESSAGE\"'\"}' $SLACK_WEBHOOKURL"
artifacts:
files:
- json_files.txt