-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
56 lines (52 loc) · 2.5 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
51
52
53
54
55
56
version: 0.2
# Pre-requisites
# - Create CodeBuild project
# - Provide minimal github credentials to access public repo
phases:
pre_build:
on-failure: ABORT
commands:
- cp settings.xml ~/.m2/
- export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain cdlib-uc3-mrt --domain-owner $AWS_ACCOUNT_ID --region $AWS_REGION --query authorizationToken --output text`
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${ECR_REGISTRY}
- COMMIT=`git rev-parse --short HEAD`
- # Get semantic tags for commit otherwise get all tags for commit, sort and choose the last value
- TAG=`(git tag --contains $COMMIT | egrep "^[0-9]+\.[0-9]+\.[0-9]+$" || git tag --contains $COMMIT || echo '') | sort | tail -1`
- |
if [[ "$MODE" == "OnPush" ]]
then
# Get Tag || Get Branch || Alternate Branch Lookup || Get Committ
BRANCHTAG=`echo $TAG | grep . || git symbolic-ref -q --short HEAD || git name-rev $(git rev-parse --short HEAD) | cut -d' ' -f2 || git rev-parse --short HEAD`
else
BRANCHTAG=$BRANCHNAME
fi
- echo "Branchtag ${BRANCHTAG}; COMMITDATE=${COMMITDATE}; REPONAME=${REPONAME}; BRANCHNAME=${BRANCHNAME}"
build:
on-failure: ABORT
commands:
- mvn -ntp -Pparent clean deploy
- mvn clean deploy -f reflect/pom.xml
- mvn -ntp clean install
- mvn deploy:deploy-file -Durl=${CODEARTIFACT_URL} -DrepositoryId=cdlib-uc3-mrt-uc3-mrt-java -Dfile=$(ls core/target/mrt-core-*.jar)
- |
for pkg in mrt-core mrt-core-util mrt-parent-properties mrt-reflectoring-bom
do
for ver in `aws codeartifact list-package-versions \
--domain=cdlib-uc3-mrt --repository=uc3-mrt-java \
--format=maven --namespace=org.cdlib.mrt \
--package=$pkg --status=Unlisted \
--output=text | grep Unlisted | cut -f4`
do
aws codeartifact delete-package-versions \
--domain=cdlib-uc3-mrt --repository=uc3-mrt-java \
--format=maven --namespace=org.cdlib.mrt \
--package=$pkg --versions=$ver --no-cli-pager
done
done
- mvn -ntp javadoc:javadoc
- rm -rf api/mrt-core2
- mkdir -p api/mrt-core2/java
- cp -r */target/site/apidocs/* api/mrt-core2/java
- echo aws s3 cp --recursive api s3://${S3CFBUCKET}/api
- aws s3 cp --recursive api s3://${S3CFBUCKET}/api
- aws cloudfront create-invalidation --distribution-id ${CFDISTRIBUTIONID} --paths /* --region us-east-1