-
Notifications
You must be signed in to change notification settings - Fork 119
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
build: tag version commit with version tag #203
build: tag version commit with version tag #203
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. One comment around the use of the print_version tool.
# grep finds the version line. It will only have two quotes. Then awk uses | ||
# the quotes as separators and prints the middle value, which corresponds to | ||
# the version inside the quotes. | ||
version=$(grep '__version__\s*=\s*' src/tbp/monty/__init__.py | awk -F'"' '{print $2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use the tools/print_version command here instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I considered it. I believe that in order to use the print_version
tool, I need to create the conda environment, install the tool, and invoke it. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Though you don't have install anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Though you don't have install anything.
What do you mean?
When I run the tool without installing via python -m tools.print_version.cli -h
I get an error:
(tbp.monty) me@not_invented_here tbp.monty % python -m tools.print_version.cli -h
Traceback (most recent call last):
File "/opt/anaconda3/envs/tbp.monty/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/anaconda3/envs/tbp.monty/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/me/tbp/tbp.monty/tools/print_version/cli.py", line 15, in <module>
import semver
ModuleNotFoundError: No module named 'semver'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge this as is for now and we can revisit in the future.
This pull request introduces a
tag_version_monty_publish
job to the Monty Publish workflow.The job is only triggered when Monty workflow on the
main
branch succeeds, which is after a commit is merged tomain
.The version is tagged only when that commit contains a version change in
src/tbp/monty/__init__.py
.The Version updated action now additionally returns
version
fromsrc/tbp/monty/__init__.py
(in addition to currently returning theversion_updated
boolean). Thisversion
is used in the tag name. For example, if the version is0.0.7
then the tag will bev0.0.7
There are fewer
if:
conditionals in this job because it only triggers on the conclusion of Monty workflow and will not run on the manual trigger.