diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-09-27 20:04:13 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-09-27 22:46:12 +0300 |
commit | cb62bf2188854c5b7c44383571ebb19a414e6137 (patch) | |
tree | d0072d22a1cf8e49ea4bb4c8f560871b1b82203c | |
parent | 646b1b5a6ce432aa0c5c0ecbd9f1d1ee330c2f03 (diff) |
Fixed release script issue with fetching recent tagsv1.6.1
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.
-rw-r--r-- | .travis.yml | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index 3714f7c..6062c42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -138,11 +138,13 @@ jobs: - LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3) - LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16))) - LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0))) - # Grab latests patch from repo tags, default to 0 - - LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES" - https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs - | jq 'map(.ref | match( - "refs/tags/v'"$LFS_VERSION_MAJOR"'\\.'"$LFS_VERSION_MINOR"'\\.(.*)$") + # Grab latests patch from repo tags, default to 0, needs finagling to get past github's pagination api + - PREV_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR. + - PREV_URL=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I + | sed -n '/^Link/{s/.*<\(.*\)>; rel="last"/\1/;p;q0};$q1' + || echo $PREV_URL) + - LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL" + | jq 'map(.ref | match("\\bv.*\\..*\\.(.*)$";"g") .captures[].string | tonumber + 1) | max // 0') # We have our new version - LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH" |