Skip to content

Commit

Permalink
fix(ci): Fix broken version bump logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dbellinghoven committed Jun 11, 2019
1 parent 9d429c9 commit 65d6363
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/release/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ git add ./VERSION ./CHANGELOG.md
git commit -m "chore: Bump version and update changelog [ci skip]"

# Tag the repo with the latest version
git tag "${VERSION}"
git tag "v${VERSION}"
10 changes: 5 additions & 5 deletions ci/release/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def enumerate_semver(version):
return (int(i.strip('vV')) for i in version.split('.'))

def get_latest_version(repo):
semver_re = re.compile("^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$")
semver_re = re.compile("^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$")

semvers = [str(tag) for tag in repo.tags if semver_re.search(str(tag))]

Expand All @@ -21,8 +21,8 @@ def get_latest_version(repo):

return semvers[0]

def next_version(version, repo, branch='master'):
latest_tagged_commit = repo.commit(str(version))
def next_version(latest_tag, version, repo, branch='master'):
latest_tagged_commit = repo.commit(latest_tag)

pre_v1 = version.major < 1

Expand All @@ -48,8 +48,8 @@ def main():
if latest_tag == '':
print('No semantic version tags found')
exit(1)
v = Version(latest_tag)
version = next_version(v, repo)
v = Version(latest_tag.strip("vV"))
version = next_version(latest_tag, v, repo)
print(version)

if __name__ == '__main__': main()
Expand Down

0 comments on commit 65d6363

Please sign in to comment.