Skip to content

Commit aa86712

Browse files
committed
chore: enable pre-release process
- Added comments in publish.yml to clarify pre-release version detection by PyPI. - Enhanced Makefile with a new pre-release target to streamline the pre-release process. - Modified pyproject.toml to support pre-release version parsing and serialization.
1 parent 64476a2 commit aa86712

File tree

5 files changed

+92
-41
lines changed

5 files changed

+92
-41
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ jobs:
191191
192192
- name: Publish package distributions to PyPI
193193
uses: pypa/gh-action-pypi-publish@release/v1
194+
# Pre-release versions (alpha, beta, rc) are automatically detected by PyPI
195+
# based on PEP 440 version format (e.g., 0.33.0a1, 0.33.0b1, 0.33.0rc1)
194196
with:
195197
packages-dir: dist/
196198
verbose: true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: mixed-line-ending
1818
- id: trailing-whitespace
1919
- repo: https://github.com/charliermarsh/ruff-pre-commit
20-
rev: "v0.14.8"
20+
rev: "v0.14.9"
2121
hooks:
2222
- id: ruff
2323
args: ["--fix"]

Makefile

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,35 @@ release: ## Bump version and create re
117117
@make docs
118118
@make clean
119119
@make build
120-
@uv lock --upgrade-package sqlspec >/dev/null 2>&1
121120
@uv run bump-my-version bump $(bump)
121+
@uv lock --upgrade-package sqlspec >/dev/null 2>&1
122122
@echo "${OK} Release complete 🎉"
123123

124+
.PHONY: pre-release
125+
pre-release: ## Start a pre-release: make pre-release version=0.33.0-alpha.1
126+
@if [ -z "$(version)" ]; then \
127+
echo "${ERROR} Usage: make pre-release version=X.Y.Z-alpha.N"; \
128+
echo ""; \
129+
echo "Pre-release workflow:"; \
130+
echo " 1. Start alpha: make pre-release version=0.33.0-alpha.1"; \
131+
echo " 2. Next alpha: make pre-release version=0.33.0-alpha.2"; \
132+
echo " 3. Move to beta: make pre-release version=0.33.0-beta.1"; \
133+
echo " 4. Move to rc: make pre-release version=0.33.0-rc.1"; \
134+
echo " 5. Final release: make release bump=patch (from rc) OR bump=minor (from stable)"; \
135+
exit 1; \
136+
fi
137+
@echo "${INFO} Preparing pre-release $(version)... 🧪"
138+
@make clean
139+
@make build
140+
@uv run bump-my-version bump --new-version $(version) pre
141+
@uv lock --upgrade-package sqlspec >/dev/null 2>&1
142+
@echo "${OK} Pre-release $(version) complete 🧪"
143+
@echo ""
144+
@echo "${INFO} Next steps:"
145+
@echo " 1. Push: git push origin HEAD"
146+
@echo " 2. Create a GitHub pre-release: gh release create v$(version) --prerelease --generate-notes --title 'v$(version)'"
147+
@echo " 3. This will publish to PyPI with pre-release tags"
148+
124149
# =============================================================================
125150
# Cleaning and Maintenance
126151
# =============================================================================

pyproject.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,30 @@ current_version = "0.32.0"
216216
ignore_missing_files = false
217217
ignore_missing_version = false
218218
message = "chore(release): bump to v{new_version}"
219-
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
219+
parse = """(?x)
220+
(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)
221+
(-(?P<pre>alpha|beta|rc)\\.(?P<pre_n>\\d+))?
222+
"""
220223
regex = false
221224
replace = "{new_version}"
222225
search = "{current_version}"
223-
serialize = ["{major}.{minor}.{patch}"]
226+
serialize = [
227+
"{major}.{minor}.{patch}",
228+
"{major}.{minor}.{patch}-{pre}.{pre_n}",
229+
]
224230
sign_tags = false
225231
tag = false
226232
tag_message = "chore(release): v{new_version}"
227233
tag_name = "v{new_version}"
228234

235+
[tool.bumpversion.parts.pre]
236+
optional_value = "stable"
237+
first_value = "stable"
238+
values = ["alpha", "beta", "rc", "stable"]
239+
240+
[tool.bumpversion.parts.pre_n]
241+
first_value = "1"
242+
229243
[[tool.bumpversion.files]]
230244
filename = "pyproject.toml"
231245
replace = 'version = "{new_version}"'

0 commit comments

Comments
 (0)