Skip to content

Commit 02fed72

Browse files
authored
feat: add release command (#687)
1 parent 36395d9 commit 02fed72

5 files changed

Lines changed: 43 additions & 11 deletions

File tree

.github/workflows/docs.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ jobs:
1919
with:
2020
python-version: "3.13"
2121

22-
- name: Set up python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v5
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
2722
- name: Install uv
2823
uses: astral-sh/setup-uv@v5
2924
with:

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ restructure the docs etc., but make sure to follow these guidelines:
7676
Creating a new release
7777
----------------------
7878

79-
1. Increment the version in ``pyproject.toml``
79+
1. Run `make release` to bump version and commit.
8080
.. note:: The version should follow `semantic versioning <https://semver.org/>`_ and `PEP 440 <https://www.python.org/dev/peps/pep-0440/>`_.
81-
2. Commit and push.
81+
2. Push and create PR.
8282
3. In GitHub go to the `releases tab <https://github.com/litestar-org/polyfactory/releases>`_
8383
4. Pick "`Draft a new release <https://github.com/litestar-org/polyfactory/releases/new>`_"
8484
5. Give it a title and a tag, both ``vX.X.X``

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ destroy: ## Destroy the virtual environment
5353
lock: ## Rebuild lockfiles from scratch, updating all dependencies
5454
@uv lock
5555

56+
.PHONY: release
57+
release:
58+
./tools/prepare-release.sh
59+
5660
# =============================================================================
5761
# Tests, Linting, Coverage
5862
# =============================================================================
@@ -107,7 +111,3 @@ docs-serve: docs-clean ## Serve the docs locally
107111
docs: docs-clean ## Dump the existing built docs and rebuild them
108112
@echo "=> Building documentation"
109113
@uv run sphinx-build -M html docs docs/_build/ -E -a -j auto --keep-going
110-
111-
changelog:
112-
@echo "=> Generating changelog"
113-
@uv run git-cliff -c pyproject.toml -o docs/changelog.rst --github-repo litestar-org/polyfactory --github-token $(GITHUB_TOKEN)

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,25 @@ dev = [
108108
"sqlalchemy[asyncio]>=1.4.29",
109109
]
110110

111+
[tool.bumpversion]
112+
allow_dirty = true
113+
commit = true
114+
commit_args = "--no-verify"
115+
current_version = "2.20.0"
116+
ignore_missing_files = false
117+
ignore_missing_version = false
118+
message = "chore(release): bump to v{new_version}"
119+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
120+
regex = false
121+
replace = "{new_version}"
122+
search = "{current_version}"
123+
serialize = ["{major}.{minor}.{patch}"]
124+
sign_tags = false
125+
tag = false
126+
tag_message = "chore(release): v{new_version}"
127+
tag_name = "v{new_version}"
128+
pre_commit_hooks = ["uv sync", "git add uv.lock docs/changelog.rst"]
129+
111130
[tool.mypy]
112131
exclude = "^tools/.*"
113132
plugins = ["pydantic.mypy"]

tools/prepare-release.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
bumped_version=$(
6+
uv run git-cliff \
7+
-c pyproject.toml \
8+
--github-token "$(gh auth token)" \
9+
--bumped-version
10+
)
11+
12+
uv run git-cliff \
13+
-c pyproject.toml \
14+
--github-token "$(gh auth token)" \
15+
--tag "$bumped_version" \
16+
--output docs/changelog.rst
17+
18+
uvx bump-my-version@1.1.2 bump --new-version "$bumped_version"

0 commit comments

Comments
 (0)