docker-lbrynet/scripts/get_release.sh

36 lines
809 B
Bash
Raw Normal View History

#!/bin/bash
set -e
2019-10-26 07:11:37 +02:00
BASE_IMAGE_NAME=lbry/lbrynet-tv
if [[ ${1} == "rc" ]]; then
API_URL="https://api.github.com/repos/lbryio/lbry/releases"
2019-06-19 15:50:54 +02:00
RC_SUFFIX="-rc"
elif [ ${1} != "" ]; then
API_URL="https://api.github.com/repos/lbryio/lbry/releases/tags/${1}"
RC_SUFFIX=""
else
API_URL="https://api.github.com/repos/lbryio/lbry/releases/latest"
RC_SUFFIX=""
fi
echo "URL: ${API_URL}"
URL=$(
curl -siL ${API_URL}|
grep browser_download_url|
grep linux|
head -n 1|
sed -E 's/.*"([^"]+)".*/\1/'
)
VERSION=$(echo $URL|sed -e 's/.*download\/v\([^"]*\)\/.*/\1/')
echo "Getting the latest version ${VERSION} from ${URL}..."
curl -OL $URL
unzip lbrynet-linux.zip
rm lbrynet-linux.zip
2019-10-26 07:11:37 +02:00
docker build -t ${BASE_IMAGE_NAME}:${VERSION} -t ${BASE_IMAGE_NAME}:latest${RC_SUFFIX} .