diff --git a/.travis.yml b/.travis.yml index ee85b119..e28d9fef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,6 @@ branches: - /^unfinished/.*$/ after_success: - ./upload.sh +- ./publish-tests.sh before_install: - '[ "$TRAVIS_PULL_REQUEST" == "false" ] && openssl aes-256-cbc -K $encrypted_35bfdf5ae630_key -iv $encrypted_35bfdf5ae630_iv -in secring.gpg.enc -out secring.gpg -d || echo "no decryption for pull requests"' \ No newline at end of file diff --git a/publish-tests.sh b/publish-tests.sh new file mode 100755 index 00000000..56379317 --- /dev/null +++ b/publish-tests.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#version: 2018-09-26 + +repo=dotify.formatter.impl + +if [ "$TRAVIS_REPO_SLUG" == "brailleapps/$repo" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then + + echo -e "Publishing tests...\n" + + mkdir -p $HOME/$repo/latest + cp -R build/docs/tests $HOME/$repo/tests + + cd $HOME + git config --global user.email "travis@travis-ci.org" + git config --global user.name "travis-ci" + git clone --quiet https://${GH_TOKEN}@github.com/brailleapps/brailleapps.github.io > /dev/null + + cd brailleapps.github.io + git rm -rf ./$repo/tests + + cp -Rf $HOME/$repo/. ./$repo + + git add -f . + git commit -m "Lastest successful travis build of $repo ($TRAVIS_BUILD_NUMBER) auto-pushed to brailleapps.github.io" + git push -fq origin master > /dev/null + + echo -e "Published tests to brailleapps.github.io.\n" + +fi