different approach to after success script

This commit is contained in:
itsmattkc
2019-03-09 09:51:18 +11:00
parent 949163352b
commit 18065216da
+27 -20
View File
@@ -8,30 +8,37 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
GREP_PATH=ggrep
fi
REMOTE=$(curl -s -N https://api.github.com/repos/olive-editor/olive/commits/master | $GREP_PATH -Po '(?<=: \")(([a-z0-9])\w+)(?=\")' -m 1)
which $GREP_PATH
# Get current repo commit from GitHub (problems arose from trying to pipe cURL directly into grep, so we buffer it through a file)
curl -s -N https://api.github.com/repos/olive-editor/olive/commits/master -o repo.txt
REMOTE=$($GREP_PATH -Po '(?<=: \")(([a-z0-9])\w+)(?=\")' -m 1 repo.txt)
LOCAL=$(git rev-parse HEAD)
if [ "$REMOTE" == "$LOCAL" ]
then
echo "[INFO] Still current. Uploading..."
# retrieve upload tool
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# upload final package
bash upload.sh Olive*.zip
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
# upload final package
bash upload.sh Olive*.AppImage*
fi
else
echo "[INFO] No longer current. $REMOTE vs $LOCAL - aborting upload."
exit 0
fi
# retrieve upload tool
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# upload final package
bash upload.sh Olive*.zip
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
find appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
# upload final package
bash upload.sh Olive*.AppImage*
fi
echo "[INFO] No longer current. $REMOTE vs $LOCAL - aborting upload."
fi