IMPORTANT: This project uses automated CI/CD for releases. Never manually publish to PyPI or create GitHub releases.
- All changes must be committed and pushed to
main - All CI tests must pass (check GitHub Actions)
- Ensure you're on the latest
mainbranch
Option 1: Using git.sh (Recommended)
# For patch release (1.2.1 → 1.2.2)
bash scripts/git.sh release patch
# For minor release (1.2.2 → 1.3.0)
bash scripts/git.sh release minor
# For major release (1.3.0 → 2.0.0)
bash scripts/git.sh release major
# For custom version
bash scripts/git.sh release 1.5.0When prompted, choose to push the tag to remote. This triggers the publish workflow.
Option 2: Manual Tag Creation
# Get current version
git describe --tags --abbrev=0
# Create new tag (e.g., v1.2.2)
git tag v1.2.2
# Push tag to trigger CI/CD
git push origin v1.2.2When you push a tag matching v*.*.*:
- GitHub Actions Publish Workflow (
.github/workflows/publish.yml) triggers - Builds the package with
uv build - Creates a GitHub Release with build artifacts
- Publishes to PyPI using trusted publishing
- Everything is versioned using
hatch-vcsbased on the git tag
# Check workflow status
gh run list --workflow=publish.yml
# Watch workflow in real-time
gh run watchOr visit: https://github.com/power-edge/pymlb_statsapi/actions
# Verify GitHub release
gh release view v1.2.2
# Verify PyPI
pip index versions pymlb-statsapi❌ NEVER manually create GitHub releases
❌ NEVER manually publish to PyPI with twine upload
❌ NEVER create tags without pushing them (this creates sync issues)
❌ NEVER delete tags after pushing (breaks CI/CD state)
This project follows Semantic Versioning:
- MAJOR (X.0.0): Breaking changes
- MINOR (x.Y.0): New features, backward compatible
- PATCH (x.y.Z): Bug fixes, backward compatible
Versions are automatically managed by hatch-vcs from git tags.
# Delete local tag
git tag -d v1.2.2
# Delete remote tag (use with caution!)
git push --delete origin v1.2.2- Check tag format: Must be
vX.Y.Z(lowercase 'v') - Verify tag is pushed:
git ls-remote --tags origin - Check GitHub Actions permissions
- Verify
PYPI_TOKENsecret is configured - Ensure version doesn't already exist on PyPI
- Check trusted publishing is configured
If a bad release was published:
- DO NOT delete the git tag or GitHub release
- Create a new patch release with the fix
- For critical issues, yank the version on PyPI:
# PyPI web interface → Manage → Yank this version
The release automation is configured in:
.github/workflows/publish.yml- Publish workflow.github/workflows/ci-cd.yml- Test workflowpyproject.toml- Build configuration with hatch-vcsscripts/git.sh- Helper script for releases
Never modify these without understanding the full impact on the release pipeline.