Просмотр исходного кода

#660 add citation with auto-update on each release

Rodja Trappe 2 лет назад
Родитель
Сommit
deed24dc09
3 измененных файлов с 34 добавлено и 0 удалено
  1. 4 0
      .github/workflows/publish.yml
  2. 17 0
      .github/workflows/update_citation.py
  3. 13 0
      CITATION.cff

+ 4 - 0
.github/workflows/publish.yml

@@ -23,6 +23,10 @@ jobs:
       - name: get version
         id: get_version
         run: echo "VERSION=$(echo ${GITHUB_REF/refs\/tags\//})" >> $GITHUB_ENV
+      - name: Update Citation
+        run: |
+          pip install PyYAML
+          python .github/workflows/update_citation.py
       - name: set version
         run: poetry version ${{ env.VERSION }}
       - name: publish

+ 17 - 0
.github/workflows/update_citation.py

@@ -0,0 +1,17 @@
+import yaml
+import os
+from datetime import datetime
+
+with open('CITATION.cff', 'r') as f:
+    citation = yaml.safe_load(f)
+
+citation['version'] = os.environ['GITHUB_REF'].split('/')[-1]
+citation['date-released'] = datetime.utcnow().strftime('%Y-%m-%d')
+# citation['doi'] = 'doi base (not ready yet)' + os.environ['GITHUB_REF'].split('/')[-1]
+
+with open('CITATION.cff', 'w') as f:
+    yaml.dump(citation, f, sort_keys=False, default_flow_style=False)
+
+os.system('git add CITATION.cff')
+os.system('git commit -m "Update CITATION.cff for release"')
+os.system('git push')

+ 13 - 0
CITATION.cff

@@ -0,0 +1,13 @@
+cff-version: 1.2.0
+message: "If you use this software, please cite it as below."
+authors:
+  - family-names: "Schindler"
+    given-names: "Falko"
+    orcid: "https://orcid.org/0000-0000-0000-0000"
+  - family-names: "Trappe"
+    given-names: "Rodja"
+    orcid: "https://orcid.org/0009-0009-4735-6227"
+title: "NiceGUI: Web-based interfaces with Python. The nice way."
+version: 1.2.2
+date-released: 2023-03-25
+url: "https://github.com/zauberzeug/nicegui"