Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some stuff #1

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Push some new travis scripts
allejo committed Feb 22, 2017
commit 043d35601c2ac3a3873c44948ddcaa82e74053c0
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@ script:
- bash .travis/build.sh
after_success:
- test $TRAVIS_PULL_REQUEST && ./.travis/surge-deploy.sh
after_failure:
- test $TRAVIS_PULL_REQUEST && ./.travis/pr_status.sh failure "Website failed to build" "https://github.com/repos/$GITHUB_REPO/pull/$TRAVIS_PULL_REQUEST"
env:
global:
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- GITHUB_USER=allejo
- GITHUB_REPO=allejo/travis-to-surge-test
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
7 changes: 7 additions & 0 deletions .travis/pr_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

STATUS=$1
DESC=$2
URL=$3

curl -u $GITHUB_USER:$GITHUB_PR_TOKEN --data "{\"state\":\"$STATUS\",\"target_url\":\"$URL\",\"description\":\"$DESC\",\"context\":\"surge.sh/staging\"}" "https://api.github.com/repos/$GITHUB_REPO/statuses/$TRAVIS_PULL_REQUEST_SHA"
11 changes: 7 additions & 4 deletions .travis/surge-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash

URL="https://allejo-surge_test-$TRAVIS_PULL_REQUEST.surge.sh"

npm install -g surge
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

URL="https://allejo-surge_test-$TRAVIS_PULL_REQUEST.surge.sh"
if [ ! -f /usr/local/bin/surge ]; then npm install -g surge; fi
surge --project ./_site --domain "$URL"
SURGE_STATUS=$?
STATUS=$([ $SURGE_STATUS -eq 0 ] && echo "success" || echo "error")
DESC=$([ $SURGE_STATUS -eq 0 ] && echo "Staging website deployed successfully" || echo "Staging website deployed failed")

curl -u allejo:$GITHUB_PR_TOKEN --data "{\"state\":\"success\",\"target_url\":\"$URL\",\"description\":\"See a website preview\",\"context\":\"surge.sh/deploy\"}" "https://api.github.com/repos/allejo/travis-to-surge-test/statuses/$TRAVIS_PULL_REQUEST_SHA"
bash $DIR/pr_status.sh $STATUS $DESC $URL