-
Notifications
You must be signed in to change notification settings - Fork 255
Add support for adding .cff-file variable in version_variables #962
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
Comments
@geddy11, the version variables specification is fairly flexible, you should be able to use [tool.semantic_release]
version_variables = [
"CITATION.cff:version",
] Since the |
Wrapping version value in quotes works. GitHub "Cite this repository"-function also handles quotes apparently, so this is acceptable solution. |
… (ie. json, yaml, etc) Previously json would not work due to the key being wrapped in quotes, yaml also has issues when it does not usually use quotes. The regex we created originally only wrapped the version to be replaced in quotes but now both the key and version can optionally be wrapped in different kind of quotations. Resolves: python-semantic-release#601, python-semantic-release#706, python-semantic-release#962, python-semantic-release#1026
… (ie. json, yaml, etc) Previously json would not work due to the key being wrapped in quotes, yaml also has issues when it does not usually use quotes. The regex we created originally only wrapped the version to be replaced in quotes but now both the key and version can optionally be wrapped in different kind of quotations. Resolves: python-semantic-release#601, python-semantic-release#706, python-semantic-release#962, python-semantic-release#1026
… (ie. json, yaml, etc) Previously json would not work due to the key being wrapped in quotes, yaml also has issues when it does not usually use quotes. The regex we created originally only wrapped the version to be replaced in quotes but now both the key and version can optionally be wrapped in different kind of quotations. Resolves: python-semantic-release#601, python-semantic-release#706, python-semantic-release#962, python-semantic-release#1026
…ie. json, yaml, etc) (#1028) * fix(version-cmd): increase `version_variable` flexibility with quotations (ie. json, yaml, etc) Previously json would not work due to the key being wrapped in quotes, yaml also has issues when it does not usually use quotes. The regex we created originally only wrapped the version to be replaced in quotes but now both the key and version can optionally be wrapped in different kind of quotations. Resolves: #601, #706, #962, #1026 * docs(configuration): add clarity to `version_variables` usage & limitations Ref: #941 * fix(version-cmd): ensure `version_variables` do not match partial variable names * build(deps-test): add `PyYAML` as a test dependency * test(fixtures): refactor location of fixture for global use of cli runner * test(stamp-version): add test cases to stamp json, python, & yaml files
🎉 This resolution has been included in version 9.8.9 🎉The release is available on: @geddy11, I know we resolved this question earlier but I wanted to let you know of the latest release which has a more flexible regular expression now that you will no longer need quotes around your version number inside your yaml file. |
This is great. Thanks for the addition. Is there a way to update |
@afuetterer, there isn't a way through a build command variable unless you calculate your own date in the shell script. I think I have a sed line in the other PR that would update the date in option 1 if that's the way you want to go. I'm not sure why I didn't think of this before but it might be a better alternative to utilize the custom changelog templating engine. There would be lot more variables and context available to update your files.
{%- set release = ctx.history.released.values() | first -%}
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Druskat
given-names: Stephan
orcid: https://orcid.org/1234-5678-9101-1121
title: "My Research Software"
version: {{ release.version | string }}
identifiers:
- type: doi
value: 10.5281/zenodo.1234
date-released: {{ release.tagged_date.strftime("%Y-%m-%d") }}
With this solution the file will be generated/updated through the changelog generation activities either with the The downside to this is that you will have to maintain your own changelog templates instead of PSR maintaining the default ones. If the release notes file doesn't exist however, it will fall back to PSRs internal default template. |
Thank you @codejedi365. I will try that. I already have my own templates in place, so another one is not a big deal. |
When you have a CITATION.cff file in a python project, the package version is stored in a variable
version
in this file which needs to be updated for each release, i.e.:Request support for adding CITATION.cff to
version_variables
list.The text was updated successfully, but these errors were encountered: