diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-10 01:21:49 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-02-10 01:21:49 +0100 |
commit | ba25922f737076fbcdbd81a01ce91240dca749db (patch) | |
tree | 96ecafecd5764ee91141dc99f5c54af218ac0c92 /.travis/deploy.sh | |
parent | b4b034d43b81e7f7febc337cc4d0abe114e3bfb5 (diff) | |
download | blogc-ba25922f737076fbcdbd81a01ce91240dca749db.tar.gz blogc-ba25922f737076fbcdbd81a01ce91240dca749db.tar.bz2 blogc-ba25922f737076fbcdbd81a01ce91240dca749db.zip |
travis: removed travis dir to .travis
Diffstat (limited to '.travis/deploy.sh')
-rwxr-xr-x | .travis/deploy.sh | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/.travis/deploy.sh b/.travis/deploy.sh new file mode 100755 index 0000000..e064ee9 --- /dev/null +++ b/.travis/deploy.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e + +if [[ "x${TRAVIS_PULL_REQUEST}" != "xfalse" ]]; then + echo "This is a pull request. skipping deploy ..." + exit 0 +fi + +if [[ "x${TRAVIS_BRANCH}" != "xmaster" ]] && [[ "x${TRAVIS_TAG}" != xv* ]]; then + echo "This isn't master branch nor a valid tag. skipping deploy ..." + exit 0 +fi + +if [[ "x${CC}" != "xgcc" ]] || [[ "x${TARGET}" = "xvalgrind" ]] || [[ "x${TARGET}" = "xmake-embedded" ]]; then + echo "Invalid target for deploy. skipping ..." + exit 0 +fi + +if [[ ! -d build ]]; then + echo "Build directory not found." + exit 1 +fi + +FILES= +if [[ -n "${TARGET}" ]] && [[ -e "travis/targets/${TARGET}.sh" ]]; then + source "travis/targets/${TARGET}.sh" +else + echo "Target not defined or invalid!" + exit 1 +fi + +deploy + +TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)" +VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" + +do_curl() { + curl \ + --silent \ + --ftp-create-dirs \ + --upload-file "${1}" \ + --user "${FTP_USER}:${FTP_PASSWORD}" \ + "ftp://${FTP_HOST}/public_html/${TARNAME}/${TARNAME}-${VERSION}/$(basename ${1})" +} + +echo " * Found files:" +for f in "${FILES[@]}"; do + echo " $(basename ${f})" +done +echo + +for f in "${FILES[@]}"; do + echo " * Processing file: $(basename ${f}):" + + echo -n " Generating SHA512 checksum ... " + pushd "$(dirname ${f})" > /dev/null + sha512sum "$(basename ${f})" > "$(basename ${f}).sha512" + popd > /dev/null + echo "done" + + echo -n " Uploading file ... " + do_curl "${f}" + echo "done" + + echo -n " Uploading SHA512 checksum ... " + do_curl "${f}.sha512" + echo "done" + + echo +done |