sourmash-bio / sourmash

Quickly search, compare, and analyze genomic and metagenomic data sets.
http://sourmash.readthedocs.io/en/latest/
Other
466 stars 79 forks source link

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

Open ccbaumler opened 5 months ago

ccbaumler commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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: https://github.com/sourmash-bio/sourmash/blob/69edb6090fea99ea4a207e1829f1afbc2f8d6172/tests/test_sourmash.py#L42-L49

Using something like: https://github.com/sourmash-bio/sourmash/blob/69edb6090fea99ea4a207e1829f1afbc2f8d6172/doc/conf.py#L65-L71