@@ -103,3 +103,46 @@ jobs:
103103 generate_release_notes : true
104104 draft : false
105105 prerelease : ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
106+
107+ # ── Job 4: Update Version Metadata ────────────────────────────
108+ # After a release is published, update CITATION.cff and README.md
109+ # on master so they always reflect the latest released version.
110+ # Uses GITHUB_TOKEN which intentionally does not trigger other
111+ # workflows, preventing infinite loops.
112+ update-metadata :
113+ name : Update Version Metadata
114+ needs : github-release
115+ runs-on : ubuntu-latest
116+ if : ${{ !contains(github.ref, 'rc') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha') }}
117+
118+ steps :
119+ - name : Checkout master
120+ uses : actions/checkout@v4
121+ with :
122+ ref : master
123+
124+ - name : Extract version and date
125+ id : meta
126+ run : |
127+ VERSION="${GITHUB_REF#refs/tags/v}"
128+ DATE="$(date -u +%Y-%m-%d)"
129+ echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
130+ echo "date=${DATE}" >> "${GITHUB_OUTPUT}"
131+
132+ - name : Update CITATION.cff
133+ run : |
134+ sed -i 's/^version: ".*"/version: "${{ steps.meta.outputs.version }}"/' CITATION.cff
135+ sed -i 's/^date-released: ".*"/date-released: "${{ steps.meta.outputs.date }}"/' CITATION.cff
136+
137+ - name : Update README.md bibtex version
138+ run : |
139+ sed -i 's/version={[^}]*}/version={${{ steps.meta.outputs.version }}}/' README.md
140+
141+ - name : Commit and push if changed
142+ run : |
143+ git diff --quiet && exit 0
144+ git config user.name "Ashutosh Mishra"
145+ git config user.email "ashutoshm1771@gmail.com"
146+ git add CITATION.cff README.md
147+ git commit -m "chore: update version metadata to ${{ steps.meta.outputs.version }}"
148+ git push origin master
0 commit comments