From 7368bb1d2db7a2a2c04b12439f37ed5a108c3d1f Mon Sep 17 00:00:00 2001 From: Gideon Thomas Date: Thu, 18 Aug 2016 15:52:30 -0400 Subject: [PATCH] Fix #8 - Travis CI integration (#12) * Fix #8 - Travis CI integration * Review fixes * Remove duplicate line --- .travis.yml | 11 +++++++++++ README.md | 3 +++ scripts/deploy.js | 20 ++++++++++---------- 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..26240ef --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: +- node +cache: + directories: + - node_modules +after_success: +- npm run deploy +env: + global: + - secure: "HRNoCqrzyNjkIoO8jV+U0Q2botBTw3xLkRTsmpe0D/s0fqZe3w6sHwzw3YK4CgQvErt3zAT4y11j5hcLT+GNOr8vztaErqJiLbW5sSdZV/0FXONAiGKjHrLqN9uK62HSQgpw9RYK03YLm32WDSm0X5fnn3lwPBqkggao/TKuKt8cItWOQ2qE/D7QdwP6yPajnbZaBLyrLGOYMFngIpFijg0AnuSfO08uWTQ504JVFJ9Qr1ZkpWJ5BCu1dhCTjK2W/URfGVBVMjh98Dte9Fls0m5W41CmsF3qqEsURSNnqjEUv8e/TjSNXhbkMPGrV0cPH2quCPZhw5xVxmsv4znLYOdw9EuxAU54s3fU2fDIZOSdqeDqEMWhQRNKcvXNlKoZD/0+gk0q9WX5Xemgwf4NnFLbot6N4DJUZemSJ/yHSsMV53F3OClthCz6D9BzE8etUiYzaBX765J+DIGGJhInBpqsQlttBZSZEQLJbZyqYO/9giUdtR/FcRGjSGDM2FHE/eiZtz7YvjRC4Zl/a97sjRUsgL47DhYH7jsoKYVIcKfLtB/jLlCX9UJrJ2KQe1opa6BTHvWbJiSbW9EvTDR9M8DhXgZqB6GuINMx1CCjsc6kqUNwkY2eetw4xoxSkZfuxOB3P//33i44qwkxJ/tr9vrBL5hQ5T/fmem0vl6Ob8w=" diff --git a/README.md b/README.md index eb6bf49..de56edf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Women and Web Literacy +[![Build Status](https://travis-ci.org/mozilla/womenandweb.svg)](https://travis-ci.org/mozilla/woemnandweb) +[![Shipping fast with zenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.com) + This repository hosts the code used to power the Women and Web Literacy hub's website. ## Development diff --git a/scripts/deploy.js b/scripts/deploy.js index 6e1f653..67f2a97 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -5,22 +5,22 @@ let pathToRepo = require(`path`).resolve(`.`); let getStatus = (repo) => repo.getStatus(); let runDeploy = () => { + if(process.env.TRAVIS_PULL_REQUEST) { + shell.echo(`Skipping deployment for pull request!`); + return; + } + shell.echo(`Running deployment now...`); - shell.exec(`git checkout master`); - shell.exec(`git pull origin master`); + shell.exec(`git stash`); + shell.exec(`git fetch origin master:master`) + shell.exec(`git checkout --orphan gh-pages master`); - shell.rm(`-rf`,`node_modules`); - - shell.exec(`npm i`); shell.exec(`npm run build`); shell.echo(`${new Date}\n\n\n`).to(`last-built.txt`); shell.exec(`git log -n 1 >> last-built.txt`); - shell.exec(`git branch -D gh-pages`); - shell.exec(`git checkout --orphan gh-pages`); - shell.rm(`.gitignore`); shell.echo(`/*\n`).toEnd(`.gitignore`); @@ -33,8 +33,8 @@ let runDeploy = () => { shell.exec(`git reset`); shell.exec(`git add .`); - shell.exec(`git commit -m 'deploy.js-ified'`); - shell.exec(`git push origin gh-pages -f`); + shell.exec(`git commit -m 'Deployed via Travis'`); + shell.exec(`git push -f https://${process.env.GH_TOKEN}@github.com/mozilla/womenandweb.git gh-pages:gh-pages`); shell.echo(`Finished deploying!`); };