Skip to content

Commit

Permalink
Travis can trigger the Github deploy API
Browse files Browse the repository at this point in the history
And other build tools like Buildkite can listen to the deploy event.
  • Loading branch information
mkllnk committed Dec 17, 2015
1 parent e67e22e commit 61a58bc
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit 61a58bc

Please sign in to comment.