From 4e2df625d3c13597abefc26cfa4ea90198575e62 Mon Sep 17 00:00:00 2001 From: Dave Machado Date: Thu, 25 May 2017 10:00:07 -0400 Subject: [PATCH] Set Travis to deploy new JSON onto master --- .travis.yml | 1 + build/deploy.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 build/deploy.sh diff --git a/.travis.yml b/.travis.yml index 671921ba..0042c6eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,6 @@ script: after_script: - cd build - sh build.sh + - sh deploy.sh notifications: email: false diff --git a/build/deploy.sh b/build/deploy.sh new file mode 100644 index 00000000..09a9e6e0 --- /dev/null +++ b/build/deploy.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -o errexit -o nounset + +if [ "$TRAVIS_BRANCH" != "master" ] +then + echo "This commit was made against $TRAVIS_BRANCH and not master! No deploy!" + exit 0 +fi + +rev=$(git rev-parse --short HEAD) + +mkdir deploy +cd deploy + +git init +git config user.name "Travis CI" +git config user.email "build@travis.org" + +git remote add upstream "https://$GH_TOKEN@github.com/davemachado/public-apis.git" +git fetch upstream +git reset upstream/master + +mv ../json/* +touch . + +git add -A . +git commit -m "rebuild JSON at ${rev}" +git push upstream HEAD:master +