Skip to content

Commit

Permalink
Use slack-15.0 as previous release
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed May 30, 2024
1 parent 6f12a6e commit 7132da2
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions tools/get_previous_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,7 @@

# github.base_ref $1

target_release=""
# force previous release to v15
target_release="slack-15.0"

base_release_branch=$(echo "$1" | grep -E 'release-[0-9]*.0$')
if [ "$base_release_branch" == "" ]; then
base_release_branch=$(echo "$2" | grep -E 'release-[0-9]*.0$')
fi
if [ "$base_release_branch" != "" ]; then
major_release=$(echo "$base_release_branch" | sed 's/release-*//' | sed 's/\.0//')
target_major_release=$((major_release-1))
target_release_number=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*.[0-9]*.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -nr | head -n1)
target_release="v$target_release_number"
else
target_major_release=$(git show-ref | grep -E 'refs/remotes/origin/release-[0-9]*\.0$' | sed 's/[a-z0-9]* refs\/remotes\/origin\/release-//' | sed 's/\.0//' | sort -nr | head -n1)
target_release_number=$(git show-ref --tags | grep -E 'refs/tags/v[0-9]*.[0-9]*.[0-9]*$' | sed 's/[a-z0-9]* refs\/tags\/v//' | awk -v FS=. -v RELEASE="$target_major_release" '{if ($1 == RELEASE) print; }' | sort -nr | head -n1)
target_release="v$target_release_number"
if [ -z "$target_release_number" ]
then
target_release="release-$target_major_release.0"
fi
fi

echo "$target_release"
echo "$target_release"

0 comments on commit 7132da2

Please sign in to comment.