This document describes how to release new versions of the Ampersend SDK packages to npm and PyPI.
The release workflows are designed to trust CI validation. Ensure the following are configured:
The main branch must have protection rules requiring CI workflows to pass before merging:
- ✅ Require status checks:
typescript-ci,python-ci,markdown-ci - ✅ Require branches to be up to date before merging
- ✅ Require pull request reviews
Why: Release workflows do not re-run validation checks. They rely on branch protection to ensure only validated code reaches main and can be tagged for release.
For additional security, configure required reviewers on the npm and pypi environments:
- Navigate to: Repository Settings → Environments → npm/pypi
- Add required reviewers (release managers)
- Enable "Prevent self-review"
Why: Adds a human approval gate before publishing to registries, preventing accidental releases.
-
Update version in
typescript/packages/ampersend-sdk/package.json# Edit version field vim typescript/packages/ampersend-sdk/package.json -
Create PR and merge to main
# Create feature branch git checkout -b release/ts-vX.Y.Z # Commit version change git add typescript/packages/ampersend-sdk/package.json git commit -m "chore(ts): bump version to X.Y.Z" # Push branch git push origin release/ts-vX.Y.Z # Create PR via GitHub UI and merge after approval
-
Create and push tag from main
# Pull latest main after PR merge git checkout main git pull origin main # Create tag # For stable release git tag ts-vX.Y.Z # For alpha release git tag ts-vX.Y.Z-alpha.N # For beta release git tag ts-vX.Y.Z-beta.N # Push tag to trigger release git push origin ts-vX.Y.Z
-
Monitor release
-
Update version in
python/ampersend-sdk/pyproject.toml# Edit version field vim python/ampersend-sdk/pyproject.toml uv sync -
Create PR and merge to main
# Create feature branch git checkout -b release/py-vX.Y.Z # Commit version change git add python/ampersend-sdk/pyproject.toml git commit -m "chore(py): bump version to X.Y.Z" # Push branch git push origin release/py-vX.Y.Z # Create PR via GitHub UI and merge after approval
-
Create and push tag from main
# Pull latest main after PR merge git checkout main git pull origin main # Create tag # For stable release git tag py-vX.Y.Z # For alpha release (PEP 440) git tag py-vX.Y.ZaN # For beta release (PEP 440) git tag py-vX.Y.ZbN # For release candidate (PEP 440) git tag py-vX.Y.ZrcN # Push tag to trigger release git push origin py-vX.Y.Z
-
Monitor release
Follow Semantic Versioning:
- Major (X.0.0): Breaking changes
- Minor (0.X.0): New features, backwards compatible
- Patch (0.0.X): Bug fixes, backwards compatible
TypeScript (npm style):
0.1.0-alpha.1- Early testing, unstable0.1.0-beta.1- Feature complete, stabilizing
Python (PEP 440 style):
0.1.0a1- Alpha release0.1.0b1- Beta release0.1.0rc1- Release candidate
If the workflow fails with "versions do not match":
- Ensure the tag version (without prefix) exactly matches the package version
- Example:
ts-v0.1.0must match"version": "0.1.0"in package.json
- Verify Trusted Publishing is configured correctly on npmjs.com
- Check workflow name and environment name match exactly
- Ensure organization, repository, and workflow filename are correct in npm settings
- Verify Trusted Publishing is configured correctly on PyPI
- Check workflow name and environment name match exactly
All npm packages are published using OIDC-based trusted publishing:
- More secure than API tokens
- No long-lived credentials to manage
- Uses GitHub's OIDC for authentication
- Automatically generates provenance attestations
All npm packages include provenance attestations:
- Proves the package was built by this specific GitHub workflow
- Visible on the npm package page
- Provides transparency and supply chain security
All Python packages use PyPI's trusted publishing:
- More secure than API tokens
- No long-lived credentials to manage
- Uses GitHub's OIDC for authentication
- Recommended by PyPI for all projects
For issues with releases:
- Check GitHub Actions logs for detailed error messages
- Review this guide and ensure all prerequisites are met
- Open an issue at https://github.com/edgeandnode/ampersend-sdk/issues