Update build_success.sh

This commit is contained in:
Andrea Cavalli 2020-08-20 21:08:01 +02:00
parent ac3416ebdf
commit 7c0c7554b7

View File

@ -2,46 +2,55 @@
set -e set -e
# ====== Setup environment variables # ====== Setup environment variables
echo "Setup variabled."
source ./travis/setup_variables.sh source ./travis/setup_variables.sh
echo "Setup variables. OK"
# ====== Copy build output # ====== Copy build output
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TRAVIS_BUILD_DIR/out/$DEST_TDJNI_LIBNAME
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TRAVIS_BUILD_DIR/out/$DEST_TDJNI_LIBNAME
mv $TDNATIVES_DOCS_BIN_DIR $TRAVIS_BUILD_DIR/out/docs mv $TDNATIVES_DOCS_BIN_DIR $TRAVIS_BUILD_DIR/out/docs
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TRAVIS_BUILD_DIR/out/$DEST_TDJNI_LIBNAME
fi fi
# ====== Deploy phase # ====== Deploy phase
# Setup ssh # Setup ssh
echo "Setup ssh."
[ -d ~/.ssh ] || mkdir -p ~/.ssh [ -d ~/.ssh ] || mkdir -p ~/.ssh
echo "$GIT_IGN_TRAVIS_DEPLOY_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa echo "$GIT_IGN_TRAVIS_DEPLOY_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa || true
chmod 600 ~/.ssh/id_rsa || true chmod 600 ~/.ssh/id_rsa || true
ssh-keyscan ssh.git.ignuranza.net >> $HOME/.ssh/known_hosts ssh-keyscan ssh.git.ignuranza.net >> $HOME/.ssh/known_hosts || true
ssh-keyscan git.ignuranza.net >> $HOME/.ssh/known_hosts ssh-keyscan git.ignuranza.net >> $HOME/.ssh/known_hosts || true
echo "Setup ssh. OK"
# Setup user # Setup user
echo "Setup git user."
git config --global user.email "andrea@cavallium.it" git config --global user.email "andrea@cavallium.it"
git config --global user.name "Andrea Cavalli" git config --global user.name "Andrea Cavalli"
git config pull.rebase false git config pull.rebase false
echo "Setup git user. OK"
# Prepare repository # Prepare repository
echo "Setup repository."
cd $TRAVIS_BUILD_DIR cd $TRAVIS_BUILD_DIR
git clone --depth=1 "git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD.git" git clone --depth=1 "git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD.git"
cd "tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD" cd "tdlight-java-natives-$TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD"
[ -d "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD" ] || mkdir -p "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD" [ -d "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD" ] || mkdir -p "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
# Add the folder to git if not added # Add the folder to git if not added
mv "$TRAVIS_BUILD_DIR/out/$DEST_TDJNI_LIBNAME" "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME" mv "$TRAVIS_BUILD_DIR/out/$DEST_TDJNI_LIBNAME" "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME"
echo "Setup repository. OK"
# IF THE NATIVE LIBRARY IS CHANGED # IF THE NATIVE LIBRARY IS CHANGED
git add "src" echo "Checking natives changed."
git add "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD" git add "src" || true
git add "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD" || true
git status --porcelain git status --porcelain
echo "File observed: $(git status --porcelain | grep "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME")" echo "File observed: $(git status --porcelain | grep "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME")"
echo "Checking natives changed. OK"
if [[ ! -z "$(git status --porcelain | grep "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME")" ]]; then if [[ ! -z "$(git status --porcelain | grep "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME")" ]]; then
# Do the upgrade of the repository # Do the upgrade of the repository
git add "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME" echo "Upgrade repository."
git add "src/main/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME" || true
mvn build-helper:parse-version versions:set \ mvn build-helper:parse-version versions:set \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \ -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \
versions:commit versions:commit
@ -65,6 +74,7 @@ if [[ ! -z "$(git status --porcelain | grep "src/main/resources/libs/$TRAVIS_OS_
git add pom.xml git add pom.xml
git commit -m "Upgrade $TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD natives" git commit -m "Upgrade $TRAVIS_OS_NAME_STANDARD-$TRAVIS_CPU_ARCH_STANDARD natives"
git push git push
echo "Upgrade repository. OK"
else else
echo "Binaries are already updated." echo "Binaries are already updated."
fi fi