Skip to content

Commit

Permalink
Write version _number_ to CITATION.cff
Browse files Browse the repository at this point in the history
While the version is generally represented as e.g. v1.4.0.post1,
in CITATION.cff the usual style is to omit the "v" and our existing
release.py script assumes this.

Solve the problem by tweaking the version-number-writing action.
  • Loading branch information
ajjackson committed Dec 12, 2024
1 parent e765aad commit 28915e8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/set_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ jobs:
import os
from packaging.version import Version
version_string = 'v' + str(Version("${{ inputs.version }}"))
version_number = str(Version("${{ inputs.version }}"))
version_string = 'v' + version_number
print(f"Normalised version string: {version_string}")
with open(os.environ["GITHUB_ENV"], "a") as github_env:
print(f"VERSION_NUMBER={version_number}", file=github_env)
print(f"VERSION_STRING={version_string}", file=github_env)
- uses: actions/checkout@v4
Expand All @@ -45,7 +47,7 @@ jobs:
- name: "Update CITATION.cff"
shell: bash -l {0}
run: |
sed -i "s/^version:\ .*/version: ${VERSION_STRING}/" CITATION.cff
sed -i "s/^version:\ .*/version: ${VERSION_NUMBER}/" CITATION.cff
sed -i "s/^date-released:\ .*/date-released: $(date -I)/" CITATION.cff
- name: "Create commit"
Expand Down

0 comments on commit 28915e8

Please sign in to comment.