This guide explains how to publish your package to PyPI using GitHub Actions.
-
Create a PyPI account
- Go to https://pypi.org/account/register/
- Create your account
-
Create a PyPI API token
- Log in to PyPI
- Go to Account Settings → API tokens
- Click "Create API token"
- Give it a name (e.g., "GitHub Actions")
- Save the token safely (you won't see it again)
-
Add PyPI token to GitHub Secrets
- Go to your GitHub repository
- Click Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
PYPI_API_TOKEN
- Value: Your PyPI token
- Click "Add secret"
- Update version in setup.py
setup(
name="celery-valkey-backend",
version="X.Y.Z", # Update this
...
)
-
Create a new release on GitHub
- Go to your repository on GitHub
- Click "Releases" on the right
- Click "Create a new release"
- Choose a tag (e.g., v1.0.0)
- Write release notes
- Click "Publish release"
-
The GitHub Action will automatically:
- Build your package
- Upload it to PyPI
After publishing:
- Check your package on PyPI: https://pypi.org/project/celery-valkey-backend/
- Try installing it:
pip install celery-valkey-backend==X.Y.Z
If the publish fails:
- Check the GitHub Actions logs
- Verify the PyPI token is correctly set
- Ensure version number is unique
- Check package build is successful locally:
python -m build
twine check dist/*
- Make changes to code
- Update tests
- Update version in setup.py
- Commit changes
- Create GitHub release
- GitHub Actions will handle PyPI publishing