#!/bin/bash
rm -rf dist || exit 0;
mkdir dist;
npm run build;
( cd dist
 git init
 git config user.name "Travis-CI"
 git config user.email "contact+travis-for-tddbin@uxebu.com"
# cp ../CNAME ./CNAME
 git add .
 git commit -m "Deployed to Github Pages"
 git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
)

#!/bin/bash

# clean up
rm -rf tmp || exit 0;

# build
npm run build;

TMP_CHECKOUT_DIR=tmp/origin-gh-pages
(
  git config user.name "Travis-CI"
  git config user.email "contact+travis-for-tddbin@uxebu.com"
  git clone --branch=gh-pages "https://${GH_TOKEN}@${GH_REF}" $TMP_CHECKOUT_DIR

  rm -rf $TMP_CHECKOUT_DIR/*
  cp -r dist/* $TMP_CHECKOUT_DIR
  cd $TMP_CHECKOUT_DIR
  git add .
  git commit -m "Travis deployed 'master' - `date`"
  git push
)

Add new changes to gh-pages instead of completely overriding the branch and loosing all deploy history.
Add new changes to gh-pages instead of completely overriding the branch and loosing all deploy history.