Browse Source

write CITATION.cff without fetching information from Zenodo

Falko Schindler 2 months ago
parent
commit
d4fe981dfe

+ 0 - 22
.github/workflows/citation.yml

@@ -1,22 +0,0 @@
-name: Release on Zenodo
-
-on:
-  release:
-    types: [published]
-
-jobs:
-  upload-to-zenodo:
-    runs-on: ubuntu-latest
-    name: A job to update metadata and push a release to Zenodo
-
-    steps:
-      - name: Upload to Zenodo
-        id: release
-        uses: codingpaula/upload-to-zenodo@fix-octet-stream
-        with:
-          github_token: ${{ secrets.GITHUB_TOKEN }}
-          zenodo_token: ${{ secrets.ZENODO_TOKEN }}
-          zenodo_deposition_id: 13623775
-          zenodo_publish: false
-          commit_message: "Update CITATION.cff"
-          citation_cff: true

+ 3 - 3
.github/workflows/publish.yml

@@ -132,13 +132,13 @@ jobs:
           python-version: "3.11"
       - name: Install httpx
         run: pip install httpx
-      - name: Update version in pyproject.toml
-        run: python .github/workflows/update_pyproject.py ${GITHUB_REF#refs/tags/}
+      - name: Update version in pyproject.toml and citation.cff
+        run: python .github/workflows/update_version.py ${GITHUB_REF#refs/tags/}
       - name: Commit and push changes
         run: |
           git config --global user.name "github-actions[bot]"
           git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
-          git add pyproject.toml
+          git add pyproject.toml CITATION.cff
           git commit -m "Update version"
           git push origin HEAD:main
 

+ 0 - 11
.github/workflows/update_pyproject.py

@@ -1,11 +0,0 @@
-#!/usr/bin/env python3
-import re
-import sys
-from pathlib import Path
-
-if __name__ == '__main__':
-    path = Path('pyproject.toml')
-    content = path.read_text(encoding='utf-8')
-    version = sys.argv[1].removeprefix('v')
-    content = re.sub(r'version = "[0-9]+\.[0-9]+\.[0-9]+-dev"', f'version = "{version}-dev"', content)
-    path.write_text(content, encoding='utf-8')

+ 24 - 0
.github/workflows/update_version.py

@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+import sys
+from datetime import datetime
+from pathlib import Path
+
+if __name__ == '__main__':
+    version = sys.argv[1].lstrip('v')
+
+    path = Path('pyproject.toml')
+    lines = path.read_text(encoding='utf-8').splitlines()
+    for i, line in enumerate(lines):
+        if line.startswith('version = '):
+            lines[i] = f'version = "{version}-dev"'
+            break
+    path.write_text('\n'.join(lines) + '\n', encoding='utf-8')
+
+    path = Path('CITATION.cff')
+    lines = path.read_text(encoding='utf-8').splitlines()
+    for i, line in enumerate(lines):
+        if line.startswith('version: '):
+            lines[i] = f'version: {version}'
+        if line.startswith('date-released: '):
+            lines[i] = f'date-released: "{datetime.now().strftime(r"%Y-%m-%d")}"'
+    path.write_text('\n'.join(lines) + '\n', encoding='utf-8')

+ 2 - 2
CITATION.cff

@@ -7,9 +7,9 @@ authors:
   - family-names: Trappe
     given-names: Rodja
     orcid: https://orcid.org/0009-0009-4735-6227
-title: 'NiceGUI: Web-based user interfaces with Python. The nice way.'
+title: "NiceGUI: Web-based user interfaces with Python. The nice way."
 version: 2.12.0
-date-released: '2025-03-03'
+date-released: "2025-03-03"
 url: https://github.com/zauberzeug/nicegui
 doi: 10.5281/zenodo.7785516
 identifiers: