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

CITATION.cff software version not up to date? #3080

Open
ccbaumler opened this issue Mar 18, 2024 · 4 comments
Open

CITATION.cff software version not up to date? #3080

ccbaumler opened this issue Mar 18, 2024 · 4 comments

Comments

@ccbaumler
Copy link
Contributor

I noticed that when clicking on the citation file in the repo (CITATION.cff), the version: is set to 2.0.0.

Is this a pinned version to the date of the citation or should it be updating with each publishing event?

@ctb
Copy link
Contributor

ctb commented Mar 18, 2024

looks like it should be updated! along with authorship stuff. we can maybe do this as part of whatever release includes the pyopensci / JOSS publication.

@ccbaumler
Copy link
Contributor Author

Sounds good. I also wrote this action for something else. It updates the version: section of the cff on release or publish.

# Inspired by https://github.com/FRBCesab/rcompendium/.github/workflows/update-citation-cff.yaml

on:
  release:
    types: [released, published]
    paths:
      - inst/CITATION
  workflow_dispatch:

name: Update CITATION.cff

jobs:
  update-citation-cff:
    runs-on: ubuntu-latest
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3

      - name: Update CITATION.cff
        run: |
          # Update CITATION.cff file
          git fetch --tags
          latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
          echo "The latest published version is $latest_tag"
          awk -v ref="$latest_tag" '/^version:/ { print "version: " ref; next }1' CITATION.cff > CITATION.cff.tmp && mv CITATION.cff.tmp CITATION.cff

      - name: Commit results
        run: |
          git config --local user.name "$GITHUB_ACTOR"
          git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
          git add CITATION.cff
          git commit -m 'doc: update CITATION.cff' || echo "No changes to commit"
          git push origin || echo "No changes to commit"

@ctb
Copy link
Contributor

ctb commented Mar 18, 2024

we could also make it part of the release process for new versions of sourmash - there's a place in there where we update the version numbers.

@ccbaumler
Copy link
Contributor Author

Sure, that is probably easier.

There is also a test already set up to use the cff. Could add a line to assert version in:

thisdir = os.path.dirname(__file__)
citation_file = os.path.join(thisdir, "../CITATION.cff")
with open(citation_file) as fp:
x = yaml.safe_load(fp)
assert x["title"] == "sourmash: a library for MinHash sketching of DNA", x

Using something like:

sourmash/doc/conf.py

Lines 65 to 71 in 69edb60

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
from importlib.metadata import version
release = version("sourmash")
version = ".".join(release.split(".")[:2])

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

No branches or pull requests

2 participants