Skip to content

Commit

Permalink
ci: add step to update version and date in citation.cff (#245)
Browse files Browse the repository at this point in the history
Fixes: #242
  • Loading branch information
afuetterer authored Jan 24, 2024
1 parent 1f87b18 commit acd403a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
with:
fetch-depth: 0 # get all commits and tags
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
- name: Update version and date in CITATION.cff
run: |
pipx install hatch
hatch run release:update-citation
git add CITATION.cff
- name: Create semantic release
id: release
uses: python-semantic-release/python-semantic-release@1d2bbdf23aab816cd9d6e26f537b5cec9e39dede # v8.7.2
Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ docs = [
lint = [
"pre-commit~=3.6",
]
release = [
"python-semantic-release~=8.7",
]
test = [
"pytest~=7.4",
"pytest-cov~=4.1",
Expand Down Expand Up @@ -114,6 +117,16 @@ build = "mkdocs build --strict --config-file=docs/mkdocs.yml"
serve = "mkdocs serve --strict --config-file=docs/mkdocs.yml"
deploy = "mkdocs gh-deploy --force --config-file=docs/mkdocs.yml"

[tool.hatch.envs.release]
features = ["release"]
[tool.hatch.envs.release.scripts]
next-version = "semantic-release version --print"
update-citation = """
sed -i "s/^version: .*/version: $(semantic-release version --print)/" CITATION.cff
sed -i "s/^date-released: .*/date-released: $(date "+%Y-%m-%d")/" CITATION.cff
cat CITATION.cff
"""

# ruff
# Ref: https://docs.astral.sh/ruff/configuration/
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit acd403a

Please sign in to comment.