mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-22 21:09:58 +00:00
I tried to do a stable release and it failed with:
```
Traceback (most recent call last):
File "/home/runner/work/lancedb/lancedb/ci/check_breaking_changes.py", line 20, in <module>
commits = repo.compare(args.base, args.head).commits
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/github/Repository.py", line 1133, in compare
headers, data = self._requester.requestJsonAndCheck("GET", f"{self.url}/compare/{base}...{head}", params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/github/Requester.py", line 548, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/github/Requester.py", line 609, in __check
raise self.createException(status, responseHeaders, data)
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest/commits/commits#compare-two-commits"}
```
I believe the problem is that we are calculating the
`LAST_STABLE_RELEASE` after we have run bump version and so the newly
created tag is in the list of tags we search and it is the most recent
one and so it gets included as `LAST_STABLE_RELEASE`. Then, the call to
github fails because we haven't pushed the tag yet. This changes the
logic to grab `LAST_STABLE_RELEASE` before we create any new tags.
52 lines
1.8 KiB
Bash
52 lines
1.8 KiB
Bash
set -e
|
|
|
|
RELEASE_TYPE=${1:-"stable"}
|
|
BUMP_MINOR=${2:-false}
|
|
TAG_PREFIX=${3:-"v"} # Such as "python-v"
|
|
HEAD_SHA=${4:-$(git rev-parse HEAD)}
|
|
|
|
readonly SELF_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
PREV_TAG=$(git tag --sort='version:refname' | grep ^$TAG_PREFIX | python $SELF_DIR/semver_sort.py $TAG_PREFIX | tail -n 1)
|
|
echo "Found previous tag $PREV_TAG"
|
|
|
|
# Initially, we don't want to tag if we are doing stable, because we will bump
|
|
# again later. See comment at end for why.
|
|
if [[ "$RELEASE_TYPE" == 'stable' ]]; then
|
|
BUMP_ARGS="--no-tag"
|
|
fi
|
|
|
|
# If last is stable and not bumping minor
|
|
if [[ $PREV_TAG != *beta* ]]; then
|
|
if [[ "$BUMP_MINOR" != "false" ]]; then
|
|
# X.Y.Z -> X.(Y+1).0-beta.0
|
|
bump-my-version bump -vv $BUMP_ARGS minor
|
|
else
|
|
# X.Y.Z -> X.Y.(Z+1)-beta.0
|
|
bump-my-version bump -vv $BUMP_ARGS patch
|
|
fi
|
|
else
|
|
if [[ "$BUMP_MINOR" != "false" ]]; then
|
|
# X.Y.Z-beta.N -> X.(Y+1).0-beta.0
|
|
bump-my-version bump -vv $BUMP_ARGS minor
|
|
else
|
|
# X.Y.Z-beta.N -> X.Y.Z-beta.(N+1)
|
|
bump-my-version bump -vv $BUMP_ARGS pre_n
|
|
fi
|
|
fi
|
|
|
|
# The above bump will always bump to a pre-release version. If we are releasing
|
|
# a stable version, bump the pre-release level ("pre_l") to make it stable.
|
|
if [[ $RELEASE_TYPE == 'stable' ]]; then
|
|
# X.Y.Z-beta.N -> X.Y.Z
|
|
bump-my-version bump -vv pre_l
|
|
fi
|
|
|
|
# Validate that we have incremented version appropriately for breaking changes
|
|
NEW_TAG=$(git describe --tags --exact-match HEAD)
|
|
NEW_VERSION=$(echo $NEW_TAG | sed "s/^$TAG_PREFIX//")
|
|
LAST_STABLE_RELEASE=$(git tag --sort='version:refname' | grep ^$TAG_PREFIX | grep -v beta | grep -vF "$NEW_TAG" | python $SELF_DIR/semver_sort.py $TAG_PREFIX | tail -n 1)
|
|
LAST_STABLE_VERSION=$(echo $LAST_STABLE_RELEASE | sed "s/^$TAG_PREFIX//")
|
|
|
|
python $SELF_DIR/check_breaking_changes.py $LAST_STABLE_RELEASE $HEAD_SHA $LAST_STABLE_VERSION $NEW_VERSION
|