Release
Automates the full release process for edictum (Python).
Arguments
- •
version(optional): The semver version to release, e.g./release 0.1.0
Step 1: Pre-flight checks
Run all checks in sequence. Abort immediately on any failure.
- •
Tests:
codeBash: pytest tests/ -v
Abort if tests fail.
- •
Lint:
codeBash: ruff check src/ tests/
Abort if lint fails.
- •
Build (dry run):
codeBash: python -m build --sdist --wheel
Abort if build fails.
- •
Clean working tree:
codeBash: git status --porcelain
Abort if output is non-empty (dirty tree).
- •
Read current version:
codeRead: pyproject.toml
Extract the
versionfield from[project]section.
Step 2: Determine new version
- •If a version argument was provided (e.g.
/release 0.1.0), use it. - •If no argument, ask the user:
code
AskUserQuestion: "What version should this release be? Current version is {current_version}." - •Validate the version:
- •Must be valid semver (MAJOR.MINOR.PATCH)
- •Must be strictly greater than the current version
- •Abort with a clear message if validation fails
Step 3: Bump version
- •
Edit
pyproject.toml:codeEdit: pyproject.toml old_string: version = "{current_version}" new_string: version = "{new_version}" - •
Commit the change:
codeBash: git add pyproject.toml && git commit -m "chore: bump version to {version}"- •Do NOT include
Co-Authored-Byin the commit message.
- •Do NOT include
Step 4: Tag and push
code
Bash: git tag v{version}
Bash: git push origin main && git push origin v{version}
Step 5: Create GitHub Release
code
Bash: gh release create v{version} --generate-notes
This auto-generates release notes from commits since the previous tag.
Step 6: Wait and verify
- •
Find the publish workflow run:
codeBash: gh run list --workflow=publish.yml --limit=1 --json databaseId,status --jq '.[0]'
- •
Watch it:
codeBash: gh run watch {run_id} - •
Report result:
- •If the run succeeds, confirm to the user: "v{version} published to PyPI successfully."
- •If the run fails, show the logs:
And report the failure to the user.code
Bash: gh run view {run_id} --log-failed
Post-release
After successful publish:
- •Verify on PyPI:
pip index versions edictum - •Test install:
pip install edictum=={version}
Important Notes
- •Always run pre-flight checks before anything else — never skip them.
- •Never amend a previous commit; always create a new one.
- •The publish workflow (
publish.yml) is triggered by the GitHub Releasepublishedevent. - •Clean up build artifacts after dry run:
rm -rf dist/ *.egg-info