Skip to content

Commit 812b098

Browse files
committed
docs: Add CITATION.cff and update its version and date during release
1 parent 4b21a43 commit 812b098

4 files changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/semantic-release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ jobs:
5656
echo "released=false" >> $GITHUB_OUTPUT
5757
fi
5858
59+
- name: Update CITATION.cff date-released
60+
run: python update_citation_date.py
61+
5962
- name: Publish package distributions to PyPI
6063
uses: pypa/gh-action-pypi-publish@release/v1
6164
if: steps.release.outputs.released == 'true'

CITATION.cff

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cff-version: 1.2.0
2+
message: "If you use pdfbaker in your work, please cite it using the following metadata."
3+
title: "pdfbaker"
4+
version: "0.8.7"
5+
date-released: 2024-04-23
6+
repository-code: "https://github.com/pythonnz/pdfbaker"
7+
license: "MIT"
8+
authors:
9+
- family-names: Adair
10+
given-names: Danny
11+
orcid: "https://orcid.org/0009-0004-8327-955X"
12+
keywords:
13+
- PDF
14+
- SVG
15+
- YAML
16+
- CLI
17+
- Python

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ score = "no"
6868

6969
[tool.semantic_release]
7070
version_toml = ["pyproject.toml:project.version"]
71+
version_variables = ["CITATION.cff:version"]
7172
branch = "main"
7273
build_command = "uv build"
7374
tag_format = "{version}"

update_citation_date.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""Set the date-released field in CITATION.cff to today."""
2+
3+
from datetime import date
4+
5+
CITATION_FILE = "CITATION.cff"
6+
7+
lines = []
8+
with open(CITATION_FILE, encoding="utf-8") as f:
9+
for line in f:
10+
if line.startswith("date-released:"):
11+
lines.append(f"date-released: {date.today()}\n")
12+
else:
13+
lines.append(line)
14+
15+
with open(CITATION_FILE, "w", encoding="utf-8") as f:
16+
f.writelines(lines)

0 commit comments

Comments
 (0)