Skip to content

Commit cb62bf2

Browse files
committed
Fixed release script issue with fetching recent tags
Fetching all tags was triggering the pagination system inside the github API. This prevent version tags from being found. Modified to use the version tag prefix in the ref lookup, however this still may cause an issue if there are still enough patch releases to trigger pagination. Simpleish solution is to grab the link header to jump to the last page, since pagination results appear to be in sorted order.
1 parent 646b1b5 commit cb62bf2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ jobs:
138138
- LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
139139
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
140140
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
141-
# Grab latests patch from repo tags, default to 0
142-
- LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES"
143-
https://github.com/api/repos/$TRAVIS_REPO_SLUG/git/refs
144-
| jq 'map(.ref | match(
145-
"refs/tags/v'"$LFS_VERSION_MAJOR"'\\.'"$LFS_VERSION_MINOR"'\\.(.*)$")
141+
# Grab latests patch from repo tags, default to 0, needs finagling to get past github's pagination api
142+
- PREV_URL=https://github.com/api/repos/$TRAVIS_REPO_SLUG/git/refs/tags/v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.
143+
- PREV_URL=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I
144+
| sed -n '/^Link/{s/.*<\(.*\)>; rel="last"/\1/;p;q0};$q1'
145+
|| echo $PREV_URL)
146+
- LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL"
147+
| jq 'map(.ref | match("\\bv.*\\..*\\.(.*)$";"g")
146148
.captures[].string | tonumber + 1) | max // 0')
147149
# We have our new version
148150
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH"

0 commit comments

Comments
 (0)