Update CITATION.cff #18
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |