Update mmtcl download to account for Drat releases (#14363)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9b688ae971
Коммит
0da164f70e
@@ -7,26 +7,13 @@
|
|||||||
REPO_TO_USE=$1
|
REPO_TO_USE=$1
|
||||||
BRANCH_TO_USE=$2
|
BRANCH_TO_USE=$2
|
||||||
|
|
||||||
BASIC_AUTH=""
|
LATEST_REL=$(curl --silent "https://api.github.com/repos/$REPO_TO_USE/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
DRAFT=$(curl --silent "https://api.github.com/repos/$REPO_TO_USE/releases/latest" | grep '"draft":' | sed -E 's/.*: ([^,]+).*/\1/')
|
||||||
# If we find a github username and token, we use that.
|
|
||||||
# In CI, these variables are available and useful to avoid rate limits which is
|
|
||||||
# much more strict for unauthenticated requests.
|
|
||||||
if [[ $GITHUB_USERNAME != "" && $GITHUB_TOKEN != "" ]];
|
|
||||||
then
|
|
||||||
BASIC_AUTH="--user $GITHUB_USERNAME:$GITHUB_TOKEN"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LATEST_REL=$(curl \
|
|
||||||
--silent \
|
|
||||||
$BASIC_AUTH \
|
|
||||||
"https://api.github.com/repos/$REPO_TO_USE/releases/latest" \
|
|
||||||
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
|
||||||
|
|
||||||
# Check if this is a release branch
|
# Check if this is a release branch
|
||||||
THIS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
THIS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
if [[ $(echo "$THIS_BRANCH" | grep -c ^"$BRANCH_TO_USE") == 1 ]];
|
if [[ "$THIS_BRANCH" =~ $BRANCH_TO_USE || $DRAFT =~ "true" ]];
|
||||||
then
|
then
|
||||||
VERSION_REL=${THIS_BRANCH//$BRANCH_TO_USE/v}
|
VERSION_REL=${THIS_BRANCH//$BRANCH_TO_USE/v}
|
||||||
REL_TO_USE=$(curl --silent $BASIC_AUTH "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -n "/$VERSION_REL/p" | sort -rV | head -n 1)
|
REL_TO_USE=$(curl --silent $BASIC_AUTH "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -n "/$VERSION_REL/p" | sort -rV | head -n 1)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user