Skip to content

Instantly share code, notes, and snippets.

@mcwnuq
Created October 22, 2017 19:34
Show Gist options
  • Save mcwnuq/06c29ddfb50fa206aefd6e3bed280f63 to your computer and use it in GitHub Desktop.
Save mcwnuq/06c29ddfb50fa206aefd6e3bed280f63 to your computer and use it in GitHub Desktop.
#!/bin/sh
#lastSuccessfulBuild=`curl -s 'https://ci.destroystokyo.com/job/PaperSpigot/api/json' | jq '.lastSuccessfulBuild.number'`
NAME="mcwnuq"
filename="$NAME-*.jar"
lastSuccessfulBuild=`curl -s https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber`
echo "najnowsza wersja to: $lastSuccessfulBuild"
if [ -f $filename ]
then
version=`ls $filename | cut -d "-" -f 2 | cut -d "." -f 1`
echo "twoja wersja to: $version"
if [ "$version" -eq "$lastSuccessfulBuild" ]
then
echo "masz najnowsza wersje"
else
echo "nie masz najnowszej wersji"
behind=`expr $lastSuccessfulBuild - $version`
echo "jestes $behind wersji wstecz"
echo "usuwam stary silnik..."
rm $filename
echo "pobieram nowy silnik..."
wget -q https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip-$lastSuccessfulBuild.jar
echo "zmieniam jego nazwe..."
mv "paperclip-$lastSuccessfulBuild.jar" "$NAME-$lastSuccessfulBuild.jar"
fi
else
echo "pobieram nowy silnik..."
wget -q https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip-$lastSuccessfulBuild.jar
echo "zmieniam jego nazwe..."
mv "paperclip-$lastSuccessfulBuild.jar" "$NAME-$lastSuccessfulBuild.jar"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment