Skip to content

Commit 7033574

Browse files
committed
do not use codedeploy
1 parent 76150c3 commit 7033574

File tree

4 files changed

+13
-46
lines changed

4 files changed

+13
-46
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jdk:
55
- oraclejdk8
66
cache:
77
directories:
8-
- '$HOME/.m2/repository'
8+
- $HOME/.m2/repository
9+
- $HOME/.cache/pip
910

1011
install:
1112
# install aws cli
@@ -15,11 +16,9 @@ install:
1516

1617
script: mvn clean test -Dspring.profiles.active=test
1718

18-
after_success:
19+
before_deploy:
1920
# Parse branch name and determine an environment to deploy
2021
- export ENV=$(echo "${TRAVIS_BRANCH}" | perl -ne "print $& if /(?<=deploy\/).*/")
21-
# Switch AWS Role when ENV is prod
22-
- test "${ENV}" = "prod" && source scripts/switch-production-role.sh
2322

2423
deploy:
2524
- provider: script

codedeploy/application_start.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

codedeploy/appspec.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/deploy.sh

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,17 @@ if [ -z "${ENV}" ]; then
55
exit 1
66
fi
77

8-
# prepare tmp directory to deploy
9-
TMP_DIR=.deploy
10-
11-
rm -rf ${TMP_DIR}
12-
mkdir ${TMP_DIR}
8+
# Switch AWS Role when ENV is prod
9+
if [ "${ENV}" = "prod" ]; then
10+
source scripts/switch-production-role.sh
11+
fi
1312

14-
# create jar
13+
# create and upload jar
1514
mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true
16-
cp ./target/springboot-angular2-tutorial-0.1.0.jar ${TMP_DIR}/app.jar
17-
18-
# create codedeploy archive
19-
tar cvzf ${TMP_DIR}/codedeploy.tar.gz -C codedeploy .
15+
aws s3 cp ./target/springboot-angular2-tutorial-0.1.0.jar s3://deploy-${ENV}.hana053.com/micropost/app.jar
2016

21-
# upload archives
22-
aws s3 sync .deploy s3://deploy-${ENV}.hana053.com/micropost
17+
# Publish to SNS Topic
18+
account_number=$(aws sts get-caller-identity --output text --query 'Account')
19+
aws sns publish --topic-arn "arn:aws:sns:${AWS_DEFAULT_REGION}:${account_number}:backend_app_updated" \
20+
--message "{\"asgName\": \"web\"}"
2321

24-
# deploy
25-
aws deploy create-deployment --application-name micropost \
26-
--s3-location bucket=deploy-${ENV}.hana053.com,key=micropost/codedeploy.tar.gz,bundleType=tgz \
27-
--deployment-group-name web

0 commit comments

Comments
 (0)