mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Update the get release script for mmctl to get the latest release even if its a pre-release for master builds (#15378)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8a101357bc
commit
907bc2906a
@@ -9,14 +9,18 @@ BRANCH_TO_USE=$2
|
||||
|
||||
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/')
|
||||
PRERELEASE=$(curl --silent "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"prerelease":' | sed -E 's/.*: ([^,]+).*/\1/')
|
||||
|
||||
# Check if this is a release branch
|
||||
THIS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
#THIS_BRANCH="release-5.27"# - Used to test release logic on a non release branch
|
||||
|
||||
if [[ "$THIS_BRANCH" =~ $BRANCH_TO_USE || $DRAFT =~ "true" ]];
|
||||
then
|
||||
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)
|
||||
REL_TO_USE=$(curl --silent "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)
|
||||
elif [[ "$THIS_BRANCH" =~ "master" ]]; then
|
||||
# Get the latest release even if its a pre-release
|
||||
REL_TO_USE=$(curl --silent "https://api.github.com/repos/$REPO_TO_USE/releases" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sort -rV | head -n 1)
|
||||
else
|
||||
REL_TO_USE=$LATEST_REL
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user