Skip to content

Commit 3880f72

Browse files
committed
Make release tag prefix optional
Needed for zlib-ng which uses x.y.z tags without a prefix.
1 parent 58d20f5 commit 3880f72

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

scripts/get-latest-github-release-tag.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ if [ -z "$GITHUB_REPO" ]; then
1111
exit 1
1212
fi
1313

14+
if [ -z "$TAG_PREFIX" ]; then
15+
TAG_PREFIX="([a-z_-]+)?"
16+
fi
17+
1418
# use GitHub token authentication on CI to prevent rate limit errors
1519
if [ -n "$GITHUB_TOKEN" ]; then
1620
GITHUB_AUTHORIZATION_HEADER="Authorization: Bearer $GITHUB_TOKEN"
@@ -28,7 +32,7 @@ if [ $? -eq 0 ]; then
2832
echo "$github_tags" \
2933
| grep '"name":' \
3034
| sed -E 's/.*"([^"]+)".*/\1/' \
31-
| egrep "^${TAG_PREFIX:-[a-z_-]+}[0-9]+[\._-][0-9]+([\._-][0-9]+)?\$" \
35+
| egrep "^${TAG_PREFIX}[0-9]+[\\._-][0-9]+([\\._-][0-9]+)?\$" \
3236
| head -n 1
3337
else
3438
echo "$github_tags" >&2

scripts/get-latest-gitlab-release-tag.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ if [ -z "$GITLAB_REPO" ]; then
1111
exit 1
1212
fi
1313

14+
if [ -z "$TAG_PREFIX" ]; then
15+
TAG_PREFIX="([a-z_-]+)?"
16+
fi
17+
1418
GITLAB_API_URL=${GITLAB_API_URL:-https://gitlab.com/api/v4}
1519
GITLAB_PROJECT=`printf %s "$GITLAB_REPO" | sed 's|/|%2F|g'`
1620

@@ -25,7 +29,7 @@ if [ $? -eq 0 ]; then
2529
latest_tag=`echo "$gitlab_releases" \
2630
| grep '"tag_name":' \
2731
| sed -E 's/.*"([^"]+)".*/\1/' \
28-
| egrep "^${TAG_PREFIX:-[a-z_-]+}[0-9]+[\._-][0-9]+([\._-][0-9]+)?$" \
32+
| egrep "^${TAG_PREFIX}[0-9]+[\\._-][0-9]+([\\._-][0-9]+)?$" \
2933
| head -n 1`
3034
if [ -n "$latest_tag" ]; then
3135
echo "$latest_tag"
@@ -43,7 +47,7 @@ if [ $? -eq 0 ]; then
4347
echo "$gitlab_tags" \
4448
| grep '"name":' \
4549
| sed -E 's/.*"([^"]+)".*/\1/' \
46-
| egrep "^${TAG_PREFIX:-[a-z_-]+}[0-9]+[\._-][0-9]+([\._-][0-9]+)?$" \
50+
| egrep "^${TAG_PREFIX}[0-9]+[\\._-][0-9]+([\\._-][0-9]+)?$" \
4751
| head -n 1
4852
else
4953
echo "$gitlab_tags" >&2

0 commit comments

Comments
 (0)