if [ -z "${BASH_SOURCE}" ] ; then echo "You need to execute this script using bash v4+ without using pipes" exit 1 fi if [[ $# -gt 2 || ( $# -eq 2 && "$2" != "latest" ) ]] ; then echo " BUILD VERSION jimmyGALLAND with [version] version and pull to hub repository USAGE: $0 [version] [latest] version (optional) nc version eg: 26.0.1 (latest version nextcloud release if ommited) latest (optional): type 'latest' if you want add latest tag to this build " fi cd "${BASH_SOURCE%/*}/" || exit 1 if [ -z $1 ]; then NC_VERS=$(curl -s https://api.github.com/repos/nextcloud/server/releases/latest \ | grep "tag_name" \ | cut -d : -f 2 \ | tr -d "\",v " \ ) else NC_VERS=$1 fi if [ -z ${NC_VERS} ]; then exit 1 fi MAJOR_VERS=$( cut -d'.' -f 1 <<< "${NC_VERS}") if [[ ( ${MAJOR_VERS} < 24 ) && ( ${MAJOR_VERS} > 27 ) ]]; then exit fi cd $MAJOR_VERS docker build --build-arg NC_VERS=${NC_VERS} --no-cache -t jimmygalland/nextcloud:${NC_VERS} . && \ docker push jimmygalland/nextcloud:${NC_VERS} && \ docker tag jimmygalland/nextcloud:${NC_VERS} git.celjim.fr/jimmygalland/nextcloud:${NC_VERS} && \ docker push git.celjim.fr/jimmygalland/nextcloud:${NC_VERS} if [[ $2 == 'latest' ]]; then docker tag jimmygalland/nextcloud:${NC_VERS} jimmygalland/nextcloud:latest && \ docker tag jimmygalland/nextcloud:${NC_VERS} git.celjim.fr/jimmygalland/nextcloud:latest && \ docker push jimmygalland/nextcloud:latest && \ docker push git.celjim.fr/jimmygalland/nextcloud:latest fi #echo "${NC_VERS}" > "../version" cd -