From 61a58bca7dd2d3937f628d5e19ac0db6d61c4d3e Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 17 Dec 2015 17:22:05 +1100 Subject: [PATCH] Travis can trigger the Github deploy API And other build tools like Buildkite can listen to the deploy event. --- .travis.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d5cf43f63cc..952804f0116 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,10 @@ rvm: # It would be better to use https://github.com/ArturT/knapsack. env: global: - TZ="Australia/Melbourne" - TIMEZONE="Australia/Melbourne" + - TZ="Australia/Melbourne" + - TIMEZONE="Australia/Melbourne" matrix: - - TEST_CASES="./spec/features/admin" + - TEST_CASES="./spec/features/admin" GITHUB_DEPLOY="true" - TEST_CASES="./spec/features/consumer ./spec/serializers ./spec/performance" - TEST_CASES="./spec/models" - TEST_CASES="./spec/controllers ./spec/views ./spec/jobs" @@ -38,5 +38,19 @@ script: - '[ "$KARMA" = "true" ] && bundle exec rake karma:run || echo "Skipping karma run"' - "bundle exec rspec $TEST_CASES" +after_success: + - > + if [ "$GITHUB_DEPLOY" = "true" -a "$TRAVIS_PULL_REQUEST" = "false" -a -n "$TRAVIS_BRANCH" -a -n "$GITHUB_API_SECRET" ]; then + description="`git show "$TRAVIS_BRANCH" -s --oneline --no-color`" + data="{ + \"ref\":\"$TRAVIS_BRANCH\", + \"description\":\"$description\", + \"environment\":\"staging\", + \"required_contexts\":[]}" + curl -u "$GITHUB_API_SECRET" -d "$data" "https://api.github.com/repos/$TRAVIS_REPO_SLUG/deployments" + else + echo "Not deploying on this build." + fi + notifications: email: false