From 8eb1ab3a2d0348e865a29c9709658b6931dd50ed Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Sat, 14 Oct 2017 00:07:12 +0200 Subject: [PATCH 1/4] deploy preview test --- .travis.yml | 3 ++- deploy.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 deploy.sh diff --git a/.travis.yml b/.travis.yml index 2818a5f..649e26d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,5 @@ script: after_success: - mv deploy_key ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa -- '[[ $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TRAVIS_BRANCH == "master" ]] && bundle exec nanoc --env=prod deploy public' +- chmod +x ./deploy.sh +- ./deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..c7b3386 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,8 @@ +#! /bin/bash +if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then + if [[ $TRAVIS_BRANCH == "master" ]]; then + bundle exec nanoc --env=prod deploy public + fi +else + rsync -aglpPrtvz --delete output/ "deploy@$TRAVIS_PULL_REQUEST.zeus.werthen.com:/var/www/html/$TRAVIS_PULL_REQUEST/" +fi From 7d066425d6114049c88623ee2653ac783e38e4cd Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Sat, 14 Oct 2017 00:11:40 +0200 Subject: [PATCH 2/4] debug --- deploy.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deploy.sh b/deploy.sh index c7b3386..d9238e6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,4 +1,6 @@ #! /bin/bash +echo "Pull Request: $TRAVIS_PULL_REQUEST" +echo "Branch: $TRAVIS_BRANCH" if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then if [[ $TRAVIS_BRANCH == "master" ]]; then bundle exec nanoc --env=prod deploy public From 81c2b25936d0943ad5b906edacaf0d9d6647b001 Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Sat, 14 Oct 2017 00:17:12 +0200 Subject: [PATCH 3/4] test travis --- deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy.sh b/deploy.sh index d9238e6..373ba4e 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,6 +1,7 @@ #! /bin/bash echo "Pull Request: $TRAVIS_PULL_REQUEST" echo "Branch: $TRAVIS_BRANCH" + if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then if [[ $TRAVIS_BRANCH == "master" ]]; then bundle exec nanoc --env=prod deploy public From de3de6b30c0acc7a5123c5c7d679eefb6c84b661 Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Sat, 14 Oct 2017 00:21:07 +0200 Subject: [PATCH 4/4] no static host checking --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 649e26d..2896159 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,10 @@ cache: - output - tmp +branches: + only: + - master + rvm: - 2.3.1 notifications: @@ -24,4 +28,5 @@ after_success: - mv deploy_key ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - chmod +x ./deploy.sh +- echo -e "Host $TRAVIS_PULL_REQUEST.zeus.werthen.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - ./deploy.sh