Skip to content

Commit

Permalink
ci: move update-citation into build_command of psr config (#364)
Browse files Browse the repository at this point in the history
Fixes #361
  • Loading branch information
afuetterer committed May 7, 2024
1 parent 344a7af commit 97277b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,12 @@ jobs:
with:
fetch-depth: 0 # get all commits and tags
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
- name: Set up Python 3.12
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.12'
- name: Install pre-requisites (e.g. hatch)
run: python -m pip install --require-hashes --requirement=.github/requirements/ci.txt
- name: Update version and date in CITATION.cff
run: |
hatch run release:update-citation
git add CITATION.cff
- name: Create semantic release
id: release
uses: python-semantic-release/python-semantic-release@6c41ec339e0e5d9802ec81f635de67f9fd940f53 # v9.7.1
with:
# allows for python-semantic-release to push to protected main branch
github_token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
git_committer_name: github-actions[bot]
git_committer_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Publish package to GitHub Release
uses: python-semantic-release/upload-to-gh-release@0f96c02a48278aff14251e9f1a0d73122a8c638b
if: ${{ steps.release.outputs.released }} == 'true'
Expand Down
21 changes: 5 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ docs = [
"mkdocs-material~=9.5",
"mkdocstrings[python]~=0.24",
]
release = [
"python-semantic-release~=9.1",
]
test = [
"pytest~=8.0",
"pytest-cov~=5.0",
Expand Down Expand Up @@ -106,17 +103,6 @@ build = "mkdocs build --config-file=docs/mkdocs.yml"
serve = "mkdocs serve --verbose --config-file=docs/mkdocs.yml"
deploy = "mkdocs gh-deploy --force --config-file=docs/mkdocs.yml"

[tool.hatch.envs.release]
features = ["release"]
template = "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 Expand Up @@ -250,15 +236,18 @@ format = "ansi"
# ------------------------------------------------------------------------------

[tool.semantic_release]
commit_author = "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit_message = "chore: release {version}\n\nAutomatically generated by python-semantic-release [skip ci]"
logging_use_named_masks = true
major_on_zero = false
tag_format = "{version}"
version_variables = [
"src/oaipmh_scythe/__about__.py:__version__",
]
assets = ["CITATION.cff"]
build_command = """
python -m pip install build[uv]
sed -i "s/^version: .*/version: $NEW_VERSION/" CITATION.cff
sed -i "s/^date-released: .*/date-released: $(date "+%Y-%m-%d")/" CITATION.cff
python -m pip install "build[uv]"
python -m build --installer=uv
"""
changelog.template_dir = ".github/templates"
Expand Down

0 comments on commit 97277b5

Please sign in to comment.