From 97277b5a62b6292a8a20f47cf20b3ee7340cad5d Mon Sep 17 00:00:00 2001 From: Heinz-Alexander Fuetterer <35225576+afuetterer@users.noreply.github.com> Date: Tue, 7 May 2024 09:07:25 +0200 Subject: [PATCH] ci: move update-citation into build_command of psr config (#364) Fixes #361 --- .github/workflows/main.yml | 12 ------------ pyproject.toml | 21 +++++---------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 04e07b8..2fbad65 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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' diff --git a/pyproject.toml b/pyproject.toml index 4709538..71d4b4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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/ # ------------------------------------------------------------------------------ @@ -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"