Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): Fix broken version bump logic #21

Merged
merged 1 commit into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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