Skip to content

Commit

Permalink
integrando deploy via travis
Browse files Browse the repository at this point in the history
  • Loading branch information
guilouro committed Aug 10, 2017
1 parent 3930e6c commit ac6ce95
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
language: node_js

node_js:
- 7

- 7
cache:
directories:
- node_modules

- node_modules
script:
- npm run lint
- npm run build
after_script:
- NODE_ENV=test ./node_modules/.bin/nyc npm test && ./node_modules/.bin/nyc report --reporter=text-lcov | coveralls
- NODE_ENV=test ./node_modules/.bin/nyc npm test && ./node_modules/.bin/nyc report
--reporter=text-lcov | coveralls
- bash ./deploy.sh
env:
global:
- GH_USER: guilouro
- GH_REPO: front-end-challenge
- secure: JANODih7RweFg8PGX4Jy2PFnVVW60VHpC3tSXqHSRvzZwZPEy9sMmURhuHylGdsjOUcSFWJaOsZJsAESqPQqB/bnuLO6Zrrticg+Bqf7SPpY/hVS6JyQEpKbR3n5OC6+M4AGUjR/fAVfcRLW0NrSWgj650K6AhQtB4ETr2g1b83NjW3VeR1z/G4E7FwilRBsFUaZ0thAh+QK2iH/QC0hDgDYGp107Qa9gA7ewR33bnQBOOU5jejMsJI0vtqykKspj+NxsKZV8dzMaW33FArZevR+5wDbKkJYVWMX6MTnNbSLDIHGNtex0uC4CPYP2qBxWc0YsuyM/G4aCHD/KyMEa9xMaBcMqaaaQEDtQHUteDkiDwVB5zDHrH4ag6RghhRVD4N8YWLsZNCY97ozNWD5uJ3p51U1IGs3Y/73LK53+mcxMDJd1q8AG/eByZKxu6dzdf8dX/LsiSt0l0RnjOjSLHjY0WEpdvuy+hEUejmTsc81VyyO6m9D1S88/nD4D84gNOzYFEEFBLYYpGfnRgXqGFOA+1x4BCAEbPc1Y9p/Ct4QVX+PQ2nOJ8Rxmx2QWXZO8vBRcBh5wbI+JFzy6sVlOW82bxK+0iHHhqp/2zAsWKkruyk/arL8wBQufex+OXfWLuRSZcMwhAYcFJizW95gNrUwrW8T86fkMnvZaEZWH4g=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/guilouro/front-end-challenge.svg?branch=master)](https://travis-ci.org/guilouro/front-end-challenge)
[![Build Status](https://travis-ci.org/guilouro/front-end-challenge.svg?branch=guilherme-louro)](https://travis-ci.org/guilouro/front-end-challenge)
[![Coverage Status](https://coveralls.io/repos/github/guilouro/front-end-challenge/badge.svg?branch=guilherme-louro)](https://coveralls.io/github/guilouro/front-end-challenge?branch=guilherme-louro)


Expand Down
36 changes: 36 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -e # exit with nonzero exit code if anything fails

if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]]; then

echo "Starting to update gh-pages\n"

#copy data we're interested in to other place
cp -R dist $HOME/dist

#go to home and setup git
cd $HOME
git config --global user.email "guilherme-louro@hotmail.com"
git config --global user.name "Guilherme Louro"

#using token clone gh-pages branch
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/${GH_USER}/${GH_REPO}.git gh-pages > /dev/null

#go into directory and copy data we're interested in to that directory
cd gh-pages
cp -Rf $HOME/dist/* .

echo "Allow files with underscore https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/" > .nojekyll
echo "[View live](https://${GH_USER}.github.io/${GH_REPO}/)" > README.md

#add, commit and push files
git add -f .
git commit -m "Travis build $TRAVIS_BUILD_NUMBER"
git push -fq origin gh-pages > /dev/null

echo "Done updating gh-pages\n"

else
echo "Skipped updating gh-pages, because build is not triggered from the master branch."
fi;

0 comments on commit ac6ce95

Please sign in to comment.