From 28915e862add0c5fdbaf3c735be9779a76bc5545 Mon Sep 17 00:00:00 2001 From: "Adam J. Jackson" Date: Thu, 12 Dec 2024 16:22:44 +0000 Subject: [PATCH] Write version _number_ to CITATION.cff 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. --- .github/workflows/set_version.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/set_version.yml b/.github/workflows/set_version.yml index 5bbf42c24..2e734e9b5 100644 --- a/.github/workflows/set_version.yml +++ b/.github/workflows/set_version.yml @@ -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 @@ -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"