From 9f16d4434c7b7b45833e610850c1a49830ba8181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Requiem?= Date: Fri, 2 Mar 2018 16:23:11 +1100 Subject: [PATCH] - allow the script to be run from anywhere and not interfere with local files - add detection for git-lfs in the local environment - at script exit/termination, remove the temporary build folder - removed hardcoded references to 'piwik' using the current flavour version - when fetching tags, fetch everything and prune old references too - when compressing in zip format apply maximum compression (-9) - fixed an issue where SHA1 wouldn't be displayed in email template - added SHA512 to email template - related to matomo-org/matomo-package#62 --- scripts/build-package.sh | 354 ++++++++++++++++++++++----------------- 1 file changed, 201 insertions(+), 153 deletions(-) diff --git a/scripts/build-package.sh b/scripts/build-package.sh index 409c018..c1dd9bb 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -5,7 +5,6 @@ # $ git tag 1.11-b3 # $ git push origin tags/1.11-b3 -VERSION="$1" ########################################### # Current Latest Matomo Major Version @@ -20,8 +19,6 @@ VERSION="$1" ########################################### CURRENT_LATEST_MAJOR_VERSION="3" -MAJOR_VERSION=`echo $VERSION | cut -d'.' -f1` - URL_REPO=https://github.com/matomo-org/matomo.git LOCAL_REPO="matomo_last_version_git" @@ -43,16 +40,20 @@ REMOTE_CMD_WWW="ssh -C piwik@${REMOTE_SERVER}" API_PATH="/home/piwik-api/www/api.piwik.org/" WWW_PATH="/home/piwik/www/" + # Setting umask so it works for most users, see https://github.com/matomo-org/matomo/issues/3869 UMASK=$(umask) umask 0022 +# this is our current folder +CURRENT_DIR="$(pwd)" + # this is where our build script is. -WORKDIR=$(echo $0 | sed 's,[^/]*$,,; s,/$,,;') -[ -z "$WORKDIR" ] && WORKDIR=$PWD +WORK_DIR="$(mktemp -d)" +cd "$WORK_DIR" # this is where our Matomo is going to be built -BUILD_DIR=$WORKDIR/../archives/ +BUILD_DIR=$WORK_DIR/archives/ trap "script_cleanup" EXIT @@ -98,6 +99,13 @@ function checkEnv() { die "Cannot find mail" fi + if [ ! -x "/usr/bin/git-lfs" -o ! -x "$(which git-lfs)" ] + then + echo "Warning: Cannot find git-lfs. Cloning Matomo may take more space than usual..." + echo "WArning: Hit CTRL+C to stop now, or wait a few seconds to continue." + sleep 5 + fi + } # this function is called whenever the script exits @@ -106,10 +114,12 @@ function script_cleanup() { # FIXME: to be removed once the script has been validated # all cleanup actions - # [ -d "$BUILD_DIR" ] && rm -rf $BUILD_DIR + [ -d "$WORK_DIR" ] && rm -rf "$WORK_DIR" # setting back umask umask $UMASK + + cd "$CURRENT_DIR" } # report error and exit @@ -190,7 +200,7 @@ function organizePackage() { rm -rf vendor/tecnickcom/tcpdf/fonts/pdf* rm -rf vendor/tecnickcom/tcpdf/fonts/times* rm -rf vendor/tecnickcom/tcpdf/fonts/uni2cid* - + rm -rf vendor/szymach/c-pchart/src/Resources/fonts/advent_light* rm -rf vendor/szymach/c-pchart/src/Resources/fonts/Bedizen* rm -rf vendor/szymach/c-pchart/src/Resources/fonts/calibri* @@ -217,7 +227,7 @@ function organizePackage() { # delete unwanted folders, recursively for x in .git ; do - find . -name "$x" -exec rm -rf {} \; + find . -name "$x" -exec rm -rf {} \; 2>/dev/null done # delete unwanted files, recursively @@ -262,113 +272,134 @@ namespace Piwik;\nclass Manifest {\n\tstatic $files=array(\n/; $ s/$/\n\t);\n}/' } -if [ -z "$1" ]; then Usage "$0"; fi +if [ -z "$1" ]; then + echo "Expected a version number as a parameter" + Usage "$0" +else + VERSION="$1" + MAJOR_VERSION=`echo $VERSION | cut -d'.' -f1` +fi + if [ -z "$2" ]; then - FLAVOUR="both" + FLAVOUR="matomo piwik" + echo "Building 'matomo' and 'piwik' archives" else if [ "$2" != "matomo" -a "$2" != "piwik" ]; then Usage "$0" else FLAVOUR="$2" + echo "Building '$2' archives" fi fi # check for local requirements checkEnv -[ ! -z "$VERSION" ] || die "Expected a version number as a parameter" +for F in $FLAVOUR; do + echo -e "Going to build Matomo $VERSION (Major version: $MAJOR_VERSION)" -echo -e "Going to build Matomo $VERSION (Major version: $MAJOR_VERSION)" + if [ "$MAJOR_VERSION" == "$CURRENT_LATEST_MAJOR_VERSION" ] + then + echo -e "-> Building a new release for the current latest major version (stable or beta)" + BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA=1 + else + echo -e "-> Building a new (stable or beta) release for the LONG TERM SUPPORT LTS (not for the current latest major version!) <-" + BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA=0 + fi -if [ "$MAJOR_VERSION" == "$CURRENT_LATEST_MAJOR_VERSION" ] -then - echo -e "-> Building a new release for the current latest major version (stable or beta)" - BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA=1 -else - echo -e "-> Building a new (stable or beta) release for the LONG TERM SUPPORT LTS (not for the current latest major version!) <-" - BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA=0 -fi + echo -e "Proceeding..." + sleep 2 -echo -e "Proceeding..." -sleep 2 + echo "Starting '$FLAVOUR' build...." -############################ -echo "Starting build...." -############################ + [ -d "$LOCAL_ARCH" ] || mkdir "$LOCAL_ARCH" + [ -d "$BUILD_DIR" ] || mkdir "$BUILD_DIR" + cd $BUILD_DIR -[ -d "$LOCAL_ARCH" ] || mkdir "$LOCAL_ARCH" + if ! [ -d "$LOCAL_REPO" ] + then + # for this to work 'git-lfs' has to be installed on the local machine + #export GIT_TRACE_PACKET=1 + #export GIT_TRACE=1 + #export GIT_CURL_VERBOSE=1 + git clone --config filter.lfs.smudge="git-lfs smudge --skip" "$URL_REPO" "$LOCAL_REPO" + if [ "$?" -ne "0" -o ! -d "$LOCAL_REPO" ] + then + die "Error: Failed to clone git repository $URL_REPO" + fi + fi -cd $BUILD_DIR + echo -e "Working in $LOCAL_REPO" + cd "$LOCAL_REPO" -if ! [ -d $LOCAL_REPO ] -then - git clone --config filter.lfs.smudge=true "$URL_REPO" "$LOCAL_REPO" -fi + # we need to exclude LFS files from the upcoming git clone/git checkout, + # unfortunately this git config command does not work... + git config lfs.fetchexclude "tests/" + # ^^ not working, LFS files are fetched below... why?! -# we need to exclude LFS files from the upcoming git clone/git checkout, -# unfortunately this git config command does not work... -git config lfs.fetchexclude "tests/" -# ^^ not working, LFS files are fetched below... why?! + git checkout master --force + git reset --hard origin/master + git checkout master + git pull -echo -e "Working in $LOCAL_REPO" + # fetch everything + git fetch --tags --all --prune -cd "$LOCAL_REPO" -git checkout master --force -git reset --hard origin/master -git checkout master -git pull -git fetch --tags -echo "checkout repository for tag $VERSION..." + echo "checkout repository for tag $VERSION..." -git branch -D "build" > /dev/null 2> /dev/null + git branch -D "build" > /dev/null 2> /dev/null -echo -e "Commit UI tests git-lfs files to avoid some problems checking out the tag..." -git add plugins/*/tests/UI/ tests/UI/expected-screenshots/* -git commit -m'committing UI tests to avoid git checkout failures...' + echo -e "Commit UI tests git-lfs files to avoid some problems checking out the tag..." + git add plugins/*/tests/UI/ tests/UI/expected-screenshots/* + git commit -m'committing UI tests to avoid git checkout failures...' -echo -e "Now checking out the tag!" -git checkout -b "build" "tags/$VERSION" > /dev/null -[ "$?" -eq "0" ] || die "tag $VERSION does not exist in repository" + echo -e "Now checking out the tag!" + git checkout -b "build" "tags/$VERSION" > /dev/null + [ "$?" -eq "0" ] || die "tag $VERSION does not exist in repository" -# clone submodules that should be in the release -for P in $(git submodule status | egrep $SUBMODULES_PACKAGED_WITH_CORE | awk '{print $2}') -do - echo -e "cloning submodule $P" - git submodule update --init $P -done + # clone submodules that should be in the release + for P in $(git submodule status | egrep $SUBMODULES_PACKAGED_WITH_CORE | awk '{print $2}') + do + echo -e "cloning submodule $P" + git submodule update --init $P + done -echo "copying files to a new directory..." -cd .. -[ -d "piwik" ] && rm -rf piwik -cp -pdr "$LOCAL_REPO" piwik -cd piwik + # leave $LOCAL_REPO folder + cd .. -[ "$(git describe --exact-match --tags HEAD)" = "$VERSION" ] || die "could not checkout to the tag for this version, make sure tag exists" + echo "copying files to a new directory..." + [ -d "$F" ] && rm -rf "$F" + cp -pdr "$LOCAL_REPO" "$F" + cd "$F" -echo "Preparing release $VERSION" -echo "Matomo version in core/Version.php: $(grep "'$VERSION'" core/Version.php)" + [ "$(git describe --exact-match --tags HEAD)" = "$VERSION" ] || die "could not checkout to the tag for this version, make sure tag exists" -[ "$(grep "'$VERSION'" core/Version.php | wc -l)" = "1" ] || die "version $VERSION does not match core/Version.php"; + echo "Preparing release $VERSION" + echo "Matomo version in core/Version.php: $(grep "'$VERSION'" core/Version.php)" -echo "Organizing files and generating manifest file..." -organizePackage + [ "$(grep "'$VERSION'" core/Version.php | wc -l)" = "1" ] || die "version $VERSION does not match core/Version.php"; -cd .. + echo "Organizing files and generating manifest file..." + organizePackage -echo "packaging release..." -rm "../$LOCAL_ARCH/piwik-$VERSION.zip" 2> /dev/null -zip -r "../$LOCAL_ARCH/piwik-$VERSION.zip" piwik How\ to\ install\ Matomo.html > /dev/null -gpg --armor --detach-sign "../$LOCAL_ARCH/piwik-$VERSION.zip" || die "Failed to sign piwik-$VERSION.zip" + # leave $F folder + cd .. -rm "../$LOCAL_ARCH/piwik-$VERSION.tar.gz" 2> /dev/null -tar -czf "../$LOCAL_ARCH/piwik-$VERSION.tar.gz" piwik How\ to\ install\ Matomo.html -gpg --armor --detach-sign "../$LOCAL_ARCH/piwik-$VERSION.tar.gz" || die "Failed to sign piwik-$VERSION.tar.gz" + echo "packaging release..." + rm "../$LOCAL_ARCH/$F-$VERSION.zip" 2> /dev/null + zip -9 -r "../$LOCAL_ARCH/$F-$VERSION.zip" "$F" How\ to\ install\ Matomo.html > /dev/null + gpg --armor --detach-sign "../$LOCAL_ARCH/$F-$VERSION.zip" || die "Failed to sign $F-$VERSION.zip" -rm "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" 2> /dev/null -zip -r "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" piwik install.sql Manifest.xml parameters.xml > /dev/null 2> /dev/null -gpg --armor --detach-sign "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" || die "Failed to sign piwik-$VERSION-WAG.zip" + rm "../$LOCAL_ARCH/$F-$VERSION.tar.gz" 2> /dev/null + tar -czf "../$LOCAL_ARCH/$F-$VERSION.tar.gz" "$F" How\ to\ install\ Matomo.html + gpg --armor --detach-sign "../$LOCAL_ARCH/$F-$VERSION.tar.gz" || die "Failed to sign $F-$VERSION.tar.gz" + rm "../$LOCAL_ARCH/$F-$VERSION-WAG.zip" 2> /dev/null + zip -9 -r "../$LOCAL_ARCH/$F-$VERSION-WAG.zip" "$F" install.sql Manifest.xml parameters.xml > /dev/null 2> /dev/null + gpg --armor --detach-sign "../$LOCAL_ARCH/$F-$VERSION-WAG.zip" || die "Failed to sign $F-$VERSION-WAG.zip" + +done # #### #### #### #### #### # # let's do the remote work # @@ -377,106 +408,123 @@ gpg --armor --detach-sign "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" || die "Failed FILES="" for ext in zip tar.gz do - FILES="$FILES ../$LOCAL_ARCH/piwik-$VERSION.$ext ../$LOCAL_ARCH/piwik-$VERSION.$ext.asc" + for F in $FLAVOUR; do + gpg --verify ../$LOCAL_ARCH/$F-$VERSION.$ext.asc + if [ "$?" -ne "0" ]; then + die "Failed to verify signature for ../$LOCAL_ARCH/$F-$VERSION.$ext" + fi + FILES="$FILES ../$LOCAL_ARCH/$F-$VERSION.$ext ../$LOCAL_ARCH/$F-$VERSION.$ext.asc" + done done echo ${REMOTE} scp -p $FILES "${REMOTE}:$REMOTE_HTTP_PATH/" -if [ "$(echo "$VERSION" | grep -E 'rc|b|a|alpha|beta|dev' -i | wc -l)" -eq 1 ] -then - if [ "$(echo $VERSION | grep -E 'rc|b|beta' -i | wc -l)" -eq 1 ] +for F in $FLAVOUR +do + if [ "$(echo "$VERSION" | grep -E 'rc|b|a|alpha|beta|dev' -i | wc -l)" -eq 1 ] then - echo -e "Beta or RC release" - - if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] + if [ "$(echo $VERSION | grep -E 'rc|b|beta' -i | wc -l)" -eq 1 ] then - echo -e "Beta or RC release of the latest Major Matomo release" - echo $REMOTE_CMD - $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST_BETA" || die "failed to deploy latest beta version file" - - echo $REMOTE_CMD_API - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - fi + echo -e "Beta or RC release" - echo -e "Updating LATEST_${MAJOR_VERSION}X_BETA version on api.piwik.org..." - echo $REMOTE_CMD_API - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] + then + echo -e "Beta or RC release of the latest Major Matomo release" + echo $REMOTE_CMD + $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST_BETA" || die "failed to deploy latest beta version file" - fi - echo "build finished! http://builds.matomo.org/piwik-$VERSION.zip" -else - echo "Stable release"; - - #linking matomo.org/latest.zip to the newly created build + echo $REMOTE_CMD_API + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + fi - if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] - then - echo -e "Built current latest Matomo major version: creating symlinks on the remote server" - for name in latest piwik piwik-latest - do - for ext in zip tar.gz; do - $REMOTE_CMD "ln -sf $REMOTE_HTTP_PATH/piwik-$VERSION.$ext $REMOTE_HTTP_PATH/$name.$ext" || die "failed to remotely link $REMOTE_HTTP_PATH/piwik-$VERSION.$ext to $REMOTE_HTTP_PATH/$name.$ext" - $REMOTE_CMD "ln -sf $REMOTE_HTTP_PATH/piwik-$VERSION.$ext.asc $REMOTE_HTTP_PATH/$name.$ext.asc" || die "failed to remotely link $REMOTE_HTTP_PATH/piwik-$VERSION.$ext/asc to $REMOTE_HTTP_PATH/$name.$ext.asc" - done - done + echo -e "Updating LATEST_${MAJOR_VERSION}X_BETA version on api.matomo.org..." + echo $REMOTE_CMD_API + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - # record filesize in MB - SIZE=$(ls -l "../$LOCAL_ARCH/piwik-$VERSION.zip" | awk '/d|-/{printf("%.3f %s\n",$5/(1024*1024),$9)}') + fi + echo "build finished! http://builds.matomo.org/$F-$VERSION.zip" + else + echo "Stable release"; - # upload to builds.matomo.org/LATEST* - echo $REMOTE_CMD - $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST" || die "cannot deploy new version file on $REMOTE" - $REMOTE_CMD "echo $SIZE > $REMOTE_HTTP_PATH/LATEST_SIZE" || die "cannot deploy new archive size on $REMOTE" - $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST_BETA" || die "cannot deploy new version file on $REMOTE" + #linking matomo.org/latest.zip to the newly created build - # upload to matomo.org/LATEST* for the website - echo $REMOTE_CMD_WWW - $REMOTE_CMD_WWW "echo $VERSION > $WWW_PATH/LATEST" || die "cannot deploy new version file on piwik@$REMOTE_SERVER" - $REMOTE_CMD_WWW "echo $SIZE > $WWW_PATH/LATEST_SIZE" || die "cannot deploy new archive size on piwik@$REMOTE_SERVER" + if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] + then + echo -e "Built current latest Matomo major version: creating symlinks on the remote server" + for name in latest $F $F-latest + do + for ext in zip tar.gz; do + $REMOTE_CMD "ln -sf $REMOTE_HTTP_PATH/$F-$VERSION.$ext $REMOTE_HTTP_PATH/$name.$ext" || die "failed to remotely link $REMOTE_HTTP_PATH/$F-$VERSION.$ext to $REMOTE_HTTP_PATH/$name.$ext" + $REMOTE_CMD "ln -sf $REMOTE_HTTP_PATH/$F-$VERSION.$ext.asc $REMOTE_HTTP_PATH/$name.$ext.asc" || die "failed to remotely link $REMOTE_HTTP_PATH/$F-$VERSION.$ext/asc to $REMOTE_HTTP_PATH/$name.$ext.asc" + done + done + # record filesize in MB + SIZE=$(ls -l "../$LOCAL_ARCH/$F-$VERSION.zip" | awk '/d|-/{printf("%.3f %s\n",$5/(1024*1024),$9)}') - echo -e "Sending email to Microsoft web team \n\n" - echo -e "Hello, \n\n\ + # upload to builds.matomo.org/LATEST* + echo $REMOTE_CMD + $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST" || die "cannot deploy new version file on $REMOTE" + $REMOTE_CMD "echo $SIZE > $REMOTE_HTTP_PATH/LATEST_SIZE" || die "cannot deploy new archive size on $REMOTE" + $REMOTE_CMD "echo $VERSION > $REMOTE_HTTP_PATH/LATEST_BETA" || die "cannot deploy new version file on $REMOTE" + + # upload to matomo.org/LATEST* for the website + echo $REMOTE_CMD_WWW + $REMOTE_CMD_WWW "echo $VERSION > $WWW_PATH/LATEST" || die "cannot deploy new version file on piwik@$REMOTE_SERVER" + $REMOTE_CMD_WWW "echo $SIZE > $WWW_PATH/LATEST_SIZE" || die "cannot deploy new archive size on piwik@$REMOTE_SERVER" + + + # only show this message when it's for 'matomo' + if [ "$F" == "matomo" ]; + then + SHA1_WINDOWS="$(sha1sum ../$LOCAL_ARCH/$F-$VERSION-WAG.zip | cut -d' ' -f1)" + [ -z "$SHA1_WINDOWS" ] && die "cannot compute sha1 hash for ../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" + SHA512_WINDOWS="$(sha512sum ../$LOCAL_ARCH/$F-$VERSION-WAG.zip | cut -d' ' -f1)" + [ -z "$SHA512_WINDOWS" ] && die "cannot compute sha512 hash for ../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" + + echo -e "Sending email to Microsoft web team \n\n" + echo -e "Hello, \n\n\ We are proud to announce a new release for Matomo (formerly Piwik)! \n\ -Matomo $VERSION can be downloaded at: http://builds.matomo.org/WebAppGallery/piwik-$VERSION-WAG.zip \n\ -SHA1 checksum is: $SHA1_WINDOWS \n\n\ +Matomo $VERSION can be downloaded at: http://builds.matomo.org/WebAppGallery/$F-$VERSION-WAG.zip \n\ +SHA1 checksum is: $SHA1_WINDOWS \n\ +SHA512 checksum is: $SHA512_WINDOWS \n\n\ Please consult the changelog for list of closed tickets: http://matomo.org/changelog/ \n\n\ We're looking forward to seeing this Matomo version on Microsoft Web App Gallery. \n\ If you have any question, feel free to ask at feedback@matomo.org. \n\n\ Thank you,\n\n\ Matomo team" - echo -e "\n----> Send this email 'New Matomo (Piwik) Version $VERSION' to appgal@microsoft.com,hello@matomo.org" + echo -e "\n----> Send this email 'New Matomo (Piwik) Version $VERSION' to appgal@microsoft.com,hello@matomo.org" + fi - fi + fi - # Copy Windows App Gallery release only for stable releases (makes Building betas faster) - echo $REMOTE - $REMOTE_CMD "test -d $REMOTE_HTTP_PATH/WebAppGallery || mkdir $REMOTE_HTTP_PATH/WebAppGallery" || die "cannot access the remote server $REMOTE" - scp -p "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" "../$LOCAL_ARCH/piwik-$VERSION-WAG.zip.asc" "${REMOTE}:$REMOTE_HTTP_PATH/WebAppGallery/" || die "failed to copy WebAppGalery files" + echo -e "" - SHA1_WINDOWS="$(sha1sum ../$LOCAL_ARCH/piwik-$VERSION-WAG.zip | cut -d' ' -f1)" - [ -z "$SHA1_WINDOWS" ] && die "cannot compute sha1 hash for ../$LOCAL_ARCH/piwik-$VERSION-WAG.zip" + # Copy Windows App Gallery release only for stable releases (makes Building betas faster) + echo $REMOTE + $REMOTE_CMD "test -d $REMOTE_HTTP_PATH/WebAppGallery || mkdir $REMOTE_HTTP_PATH/WebAppGallery" || die "cannot access the remote server $REMOTE" + scp -p "../$LOCAL_ARCH/$F-$VERSION-WAG.zip" "../$LOCAL_ARCH/$F-$VERSION-WAG.zip.asc" "${REMOTE}:$REMOTE_HTTP_PATH/WebAppGallery/" || die "failed to copy WebAppGalery files" - echo -e "" - if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] - then - echo -e "Updating LATEST and LATEST_BETA versions on api.matomo.org..." - echo $REMOTE_CMD_API - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - fi + if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] + then + echo -e "Updating LATEST and LATEST_BETA versions on api.matomo.org..." + echo $REMOTE_CMD_API + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + fi - echo -e "Updating the LATEST_${MAJOR_VERSION}X and LATEST_${MAJOR_VERSION}X_BETA version on api.piwik.org" - echo $REMOTE_CMD_API - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + echo -e "Updating the LATEST_${MAJOR_VERSION}X and LATEST_${MAJOR_VERSION}X_BETA version on api.piwik.org" + echo $REMOTE_CMD_API + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" + $REMOTE_CMD_API "echo $VERSION > $API_PATH/LATEST_${MAJOR_VERSION}X_BETA" || die "cannot deploy new version file on piwik-api@$REMOTE_SERVER" - if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] - then - echo -e "build finished! http://builds.matomo.org/piwik.zip" - else - echo -e "build for LONG TERM SUPPORT version finished! http://builds.matomo.org/piwik-$VERSION.zip" + if [ "$BUILDING_LATEST_MAJOR_VERSION_STABLE_OR_BETA" -eq "1" ] + then + echo -e "build finished! http://builds.matomo.org/$F.zip" + else + echo -e "build for LONG TERM SUPPORT version finished! http://builds.matomo.org/$F-$VERSION.zip" + fi fi -fi +done