From 3119d6a2edcceef4abd0ad7e856b2e541e3c7252 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 23 Jun 2016 13:27:05 +0200 Subject: [PATCH 1/2] Travis setup --- .travis.yml | 23 +++++++++++++++++++++++ README.md | 4 ++-- _ci/build.sh | 12 ++++++++++++ _ci/deploy.sh | 16 +++++++++++++--- _ci/setup.sh | 12 ++++++++++++ 5 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..add4367 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +sudo: required +dist: trusty + +language: node_js +node_js: + - "6" + +cache: + directories: + - node_modules + +before_script: "_ci/setup.sh" +script: "_ci/build.sh" + +deploy: + skip_cleanup: true + provider: script + script: "_ci/deploy.sh" + on: + branch: master + +notifications: + email: false diff --git a/README.md b/README.md index c26baae..ae4514b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > WordPress theme for ascribe's landing page and blog -[ ![Codeship Status for ascribe/wp-theme](https://codeship.com/projects/33c7d280-cf2d-0133-1c09-5ed74b30bb55/status?branch=master)](https://codeship.com/projects/141150) +[![Build Status](https://travis-ci.com/ascribe/wp-theme.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=master)](https://travis-ci.com/ascribe/wp-theme) ## Prerequisites @@ -33,7 +33,7 @@ gulp build ## Deployment: Continuous Delivery -The theme under `ascribe/` gets built & deployed automatically via Codeship under the following conditions: +The theme under `ascribe/` gets built & deployed automatically via Travis under the following conditions: - every push builds the site - every push to the master branch initiates a live deployment diff --git a/_ci/build.sh b/_ci/build.sh index 38956eb..231fdc0 100755 --- a/_ci/build.sh +++ b/_ci/build.sh @@ -2,6 +2,18 @@ set -e; +echo "$(tput setaf 136)" +echo "=============================================" +echo " Starting build " +echo "=============================================" +echo "$(tput sgr0)" # reset + gulp build +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done building" +echo "---------------------------------------------" +echo "$(tput sgr0)" # reset + exit; diff --git a/_ci/deploy.sh b/_ci/deploy.sh index 41934a2..01c4a2b 100755 --- a/_ci/deploy.sh +++ b/_ci/deploy.sh @@ -4,8 +4,18 @@ set -e; -if [ $CI_BRANCH == "master" ]; then - rsync --recursive --delete --delete-excluded --checksum --verbose -e "ssh" $DEPLOY_SRC $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH -fi; +echo "$(tput setaf 136)" +echo "=============================================" +echo " Start deployment: live " +echo "=============================================" +echo "$(tput sgr0)" # reset + +rsync --recursive --delete --delete-excluded --checksum --verbose -e "ssh" $DEPLOY_SRC $DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH + +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done deployment: live" +echo "---------------------------------------------" +echo "$(tput sgr0)" # reset exit; diff --git a/_ci/setup.sh b/_ci/setup.sh index d14441c..eafac58 100755 --- a/_ci/setup.sh +++ b/_ci/setup.sh @@ -2,7 +2,19 @@ set -e; +echo "$(tput setaf 136)" +echo "=============================================" +echo " Installing dependencies " +echo "=============================================" +echo "$(tput sgr0)" # reset + npm install gulp -g npm install +echo "$(tput setaf 64)" # green +echo "---------------------------------------------" +echo " ✓ done installing dependencies" +echo "---------------------------------------------" +echo "$(tput sgr0)" # reset + exit; From faff0725cd28914e322c122087226d842b8c476c Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 23 Jun 2016 13:34:06 +0200 Subject: [PATCH 2/2] add environment variables to .travis.yml --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index add4367..d30d2ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,3 +21,10 @@ deploy: notifications: email: false + +env: + global: + - DEPLOY_SRC=ascribe/ + - DEPLOY_USER=deploy + - DEPLOY_HOST=ec2-52-29-65-193.eu-central-1.compute.amazonaws.com + - DEPLOY_PATH=/var/www/ascribe-wp/wp-content/themes/ascribe/