Skip to content

Update CITATION.cff #10

Update CITATION.cff

Update CITATION.cff #10

name: Update CITATION.cff
on:
release:
types: released
branches:
- main
workflow_dispatch:
jobs:
update-citation-cff:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- 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"
echo $(git status)
git add CITATION.cff
git commit -m 'doc: update CITATION.cff' || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Adjust tag
run: |
git fetch --tags
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
latest_hash=$(git rev-parse HEAD)
git tag -d $latest_tag
git tag $latest_tag $latest_hash
git push --force origin $latest_tag