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

update release.py #6

Merged
merged 3 commits into from
Oct 4, 2020
Merged

update release.py #6

merged 3 commits into from
Oct 4, 2020

Conversation

XueyanZhang
Copy link
Collaborator

Imported 're' lib to detect validity of tag names.

if current_tag[0] != 'v':
raise Exception("The tag name should start with v")

if not re.match("^v[0-9][.][0-9]", current_tag):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The major number can have multiple digits. So the regexp should ^v[0-9]+[.][0-9]


if not re.match("^v[0-9][.][0-9]", current_tag):
raise Exception("Error: tag name does not follow expected pattern.")

major_version = int(current_tag[1])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works with single-digit number.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address this, in you first get the index of the ..

Then get the major version by slicing the string from the second character until the . character.

For the minor version, just the characters after ..

@@ -46,7 +47,7 @@ def main():
jar = build_binary()

# release
release_command = ['hub', 'release', 'create', '-a', jar, '-m', title, tag_name]
release_command = ['hub', 'release', 'create', '-o', '-a', jar, '-m', title, tag_name]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For scripts, it is better to use long flags than short flags.

Short flags are useful for interactive shells, while long flags are helpful for documentation purpose.

@@ -46,7 +47,7 @@ def main():
jar = build_binary()

# release
release_command = ['hub', 'release', 'create', '-a', jar, '-m', title, tag_name]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be improved with f-string.

https://realpython.com/python-f-strings/


if not re.match("^v[0-9][.][0-9]", current_tag):
raise Exception("Error: tag name does not follow expected pattern.")

major_version = int(current_tag[1])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address this, in you first get the index of the ..

Then get the major version by slicing the string from the second character until the . character.

For the minor version, just the characters after ..

@chengniansun chengniansun merged commit 1efeefd into uw-pluverse:master Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants