www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 1f81d3309696ebbfbed6e3b1b7dce5dfac21d05a
parent 90b4c343cbb0b4e893536a78663649e113f5d20e
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Tue, 21 Mar 2017 18:12:15 +0100

Attempt to auto-push to master when the dev build succeeds

Diffstat:
M.travis.yml | 3+++
Aauto-push-master.sh | 40++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/.travis.yml b/.travis.yml @@ -76,3 +76,6 @@ script: #after_success: # - raco pkg install --deps search-auto cover cover-coveralls # - raco cover -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage . + +after_success: + - sh ./auto-push-master.sh diff --git a/auto-push-master.sh b/auto-push-master.sh @@ -0,0 +1,39 @@ +#!/bin/sh +set -e +set +x +if test "$(git config remote.origin.url)" != "https://github.com/jsmaniac/phc-thesis.git"; then + echo "Not on official repo, will not auto-push to master." +elif test "$TRAVIS_PULL_REQUEST" != "false"; then + echo "This is a Pull Request, will not auto-push to master." +elif test "$TRAVIS_BRANCH" != "dev"; then + echo "Not on dev branch (TRAVIS_BRANCH = $TRAVIS_BRANCH), will not auto-push to master." +elif test -z "${encrypted_8fdb34b09f5e_key:-}" -o -z "${encrypted_8fdb34b09f5e_iv:-}"; then + echo "Travis CI secure environment variables are unavailable, will not auto-push to master." +else + set -x + echo "Automatic push to master" + + ## Git configuration: + #git config --global user.name "$(git log --format="%aN" HEAD -1) (Travis CI automatic commit)" + #git config --global user.email "$(git log --format="%aE" HEAD -1)" + + # SSH configuration + mkdir -p ~/.ssh + chmod 700 ~/.ssh + set +x + if openssl aes-256-cbc -K $encrypted_8fdb34b09f5e_key -iv $encrypted_8fdb34b09f5e_iv -in travis-deploy-key-id_rsa.enc -out ~/.ssh/travis-deploy-key-id_rsa -d >/dev/null 2>&1; then + echo "Decrypted key successfully." + else + echo "Error while decrypting key." + fi + set -x + chmod 600 ~/.ssh/travis-deploy-key-id_rsa + set +x + eval `ssh-agent -s` + set -x + ssh-add ~/.ssh/travis-deploy-key-id_rsa + + git log --oneline --decorate --graph -10 + echo 'git push --quiet "https://git@github.com/jsmaniac/phc-thesis.git" HEAD:master' + (git push --force --quiet "git@github.com:jsmaniac/phc-thesis.git" master:gh-pages >/dev/null 2>&1) >/dev/null 2>&1 # redirect to /dev/null to avoid showing credentials. +fi +\ No newline at end of file