mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Update mmtcl download to account for Drat releases (#14363)
This commit is contained in:
committed by
GitHub
parent
9b688ae971
commit
0da164f70e
@@ -7,26 +7,13 @@
|
||||
REPO_TO_USE=$1
|
||||
BRANCH_TO_USE=$2
|
||||
|
||||
BASIC_AUTH=""
|
||||
|
||||
# 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/')
|
||||
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/')
|
||||
|
||||
# Check if this is a release branch
|
||||
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
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user