From 455a6e0cef688af92b53d4b7f084a8b9aa6869ce Mon Sep 17 00:00:00 2001 From: Sebastien Date: Thu, 1 Mar 2018 16:02:58 +0100 Subject: [PATCH] I love bash! Joke! --- DownloadLast.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/DownloadLast.sh b/DownloadLast.sh index f2d0d72..620e0c2 100755 --- a/DownloadLast.sh +++ b/DownloadLast.sh @@ -1,20 +1,19 @@ #!/bin/bash #This script download the last stable build on jenkins +echo "Branch: "$1 +if [[ $1 = "master" ]] +then + base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/" +else + base_url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle%20Devel/lastStableBuild/artifact/" +fi -data=$(curl -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts") +data=$(curl -s -g "https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/api/xml?xpath=/freeStyleBuild/artifact&wrapper=artifacts") relativePath=$(grep -oPm1 "(?<=)[^<]+" <<< "$data") jarFile=$(grep -oPm1 "(?<=)[^<]+" <<< "$data") -echo $1 - -if [[ $1 = "master" ]] -then - url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle/lastStableBuild/artifact/"${relativePath} -else - url="https://jenkins.seb6596.ovh/job/Bot%20Discord%20Gradle%20Devel/lastStableBuild/artifact/"${relativePath} -fi -echo ${url} - -wget ${url} -O bot.jar -q + + +wget ${base_url}${relativePath} -O bot.jar -q