ClaptrapBot/DownloadLast.sh

20 lines
576 B
Bash
Raw Normal View History

2018-03-01 12:10:30 +01:00
#!/bin/bash
#This script download the last stable build on jenkins
2018-03-01 16:02:58 +01:00
echo "Branch: "$1
if [[ $1 = "master" ]]
then
2018-03-01 16:04:38 +01:00
base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild"
2018-03-01 16:02:58 +01:00
else
2018-03-01 16:04:38 +01:00
base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle%20Devel/lastStableBuild/"
2018-03-01 16:02:58 +01:00
fi
2018-03-01 12:10:30 +01:00
2018-03-01 16:04:38 +01:00
data=$(curl -s -g ${base_url}"/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts")
2018-03-01 12:10:30 +01:00
relativePath=$(grep -oPm1 "(?<=<relativePath>)[^<]+" <<< "$data")
jarFile=$(grep -oPm1 "(?<=<fileName>)[^<]+" <<< "$data")
2018-03-01 13:17:32 +01:00
2018-03-01 13:21:42 +01:00
2018-03-01 13:17:32 +01:00
2018-03-01 16:07:26 +01:00
wget ${base_url}"/artifact/"${relativePath} -O bot.jar -nq
2018-03-01 12:10:30 +01:00