This commit is contained in:
Rico Sta. Cruz 2015-01-23 09:18:39 +08:00
parent 00982adb13
commit 676b8d5092
1 changed files with 4 additions and 4 deletions

View File

@ -21,21 +21,21 @@ travis encrypt -r user/repo GH_TOKEN=[the token here]
### Make it run the deploy script on deploy ### Make it run the deploy script on deploy
``` ```yaml
# .travis.yml # .travis.yml
script: script:
- bash ./scripts/deploy-to-gh-pages.sh - bash ./scripts/deploy-to-gh-pages.sh
env: env:
global: global:
- GH_REF: "github.com/user/repo.git" - GH_REF: "github.com/user/repo.git"
- secure: "nlnXJW/imf/w..." - secure: "nlnXJW/imf/w..." # <-- from travis-encrypt
``` ```
### Write deployer ### Write deployer
Create the file `scripts/deploy-to-gh-pages.sh` Create the file `scripts/deploy-to-gh-pages.sh`
``` ```sh
#!/bin/bash #!/bin/bash
# See https://medium.com/@nthgergo/publishing-gh-pages-with-travis-ci-53a8270e87db # See https://medium.com/@nthgergo/publishing-gh-pages-with-travis-ci-53a8270e87db
set -o errexit set -o errexit
@ -58,7 +58,7 @@ git commit -m "Deploy to Github Pages"
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
``` ```
From Ractive: From Ractive, this might be useful in certain cases:
``` ```
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then exit 0; fi if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "master" ]; then exit 0; fi