File tree Expand file tree Collapse file tree 4 files changed +33
-32
lines changed Expand file tree Collapse file tree 4 files changed +33
-32
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,5 @@ db/**/*.db
18
18
! .elasticbeanstalk /* .global.yml
19
19
20
20
.deploy
21
+
22
+ .envrc
Original file line number Diff line number Diff line change @@ -11,36 +11,19 @@ install:
11
11
# install aws cli
12
12
- sudo apt-get -y install python-pip
13
13
- sudo pip install awscli
14
+ - aws --version
14
15
15
16
script : mvn clean test -Dspring.profiles.active=test
16
17
17
- after_success :
18
+ before_deploy :
18
19
# Parse branch name and determine an environment to deploy
19
20
- export ENV=$(echo "${TRAVIS_BRANCH}" | perl -ne "print $& if /(?<=deploy\/).*/")
20
21
# Switch AWS Role when ENV is prod
21
22
- test "${ENV}" = "prod" && source scripts/switch-production-role.sh
22
23
23
- before_deploy :
24
- # Create an archive to deploy
25
- - scripts/create-archives.sh
26
24
deploy :
27
- # upload jar and codedeploy scripts
28
- - provider : s3
29
- bucket : deploy-${ENV}.hana053.com
30
- region : ${AWS_DEFAULT_REGION}
31
- local_dir : .deploy
32
- upload-dir : micropost
25
+ - provider : script
26
+ script : scripts/deploy.sh
33
27
skip_cleanup : true
34
28
on :
35
29
branch : deploy/*
36
- # deploy by using codedeploy
37
- - provider : codedeploy
38
- bucket : deploy-${ENV}.hana053.com
39
- region : ${AWS_DEFAULT_REGION}
40
- key : micropost/codedeploy.tar.gz
41
- application : micropost
42
- deployment_group : web
43
- bundle_type : tgz
44
- on :
45
- branch : deploy/*
46
-
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if [ -z " ${ENV} " ]; then
4
+ echo " ENV is required."
5
+ exit 1
6
+ fi
7
+
8
+ # prepare tmp directory to deploy
9
+ TMP_DIR=.deploy
10
+
11
+ rm -rf ${TMP_DIR}
12
+ mkdir ${TMP_DIR}
13
+
14
+ # create jar
15
+ 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 .
20
+
21
+ # upload archives
22
+ aws s3 sync .deploy s3://deploy-${ENV} .hana053.com/micropost
23
+
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
You can’t perform that action at this time.
0 commit comments