From 499b3ddf3e84b304a87fb1e2f785b3bf2890b2e9 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Sat, 25 Jun 2016 16:54:35 +0200 Subject: [PATCH] Added a script to upload emscripten build automatically to gh_pages --- .travis.yml | 3 +++ tools/deploy-emscripten.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tools/deploy-emscripten.sh diff --git a/.travis.yml b/.travis.yml index 3ac489fae..d7e55d44d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -120,3 +120,6 @@ after_success: - if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$BUILD_TYPE" == "Qt" ]; then python tools/upload-binaries.py -t $GH_TOKEN -s $TRAVIS_COMMIT -l build_qt_widget/wagic.dmg -r Wagic-macosx.dmg -b $TRAVIS_BRANCH; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$BUILD_TYPE" == "Emscripten" ]; then + ./tools/deploy-emscripten.sh; + fi diff --git a/tools/deploy-emscripten.sh b/tools/deploy-emscripten.sh new file mode 100644 index 000000000..5aa792258 --- /dev/null +++ b/tools/deploy-emscripten.sh @@ -0,0 +1,31 @@ +#!/bin/sh -e + +## New of branch to use +TARGET_BRANCH=gh_pages + +## Only deploy on gh_pages the cmake or master branch +(test "$TRAVIS_BRANCH" != "master" && test "$TRAVIS_BRANCH" != "cmake") && exit 0 + +## Configure Git to use OAuth token +git config credential.helper "store --file=.git/credentials" +echo "https://${GH_TOKEN}:@github.com" > .git/credentials +git config --global user.name $GH_USER +git config --global user.email $GH_EMAIL +git remote set-url origin "https://${GH_TOKEN}@github.com/WagicProject/wagic.git" + +## checkout gh_branch and cleans it up +git clone $REPO out +cd out +git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH +rm -rf **/* || exit 0 + +## Move emscripten files in the out directory +mv ../build_emscripten/bin/wagic.html index.html +mv ../build_emscripten/bin/wagic.js wagic.js +mv ../build_emscripten/bin/wagic.data wagic.data + +## Add, commit and push to GH +git add . +git commit -m "Deploy Emscripten to Github pages" +## Push new branch to remote server +git push -q origin $TARGET_BRANCH:$TARGET_BRANCH 2> /dev/null > /dev/null