|
| 1 | +# Publishing Taskra to PyPI |
| 2 | + |
| 3 | +This project uses **Poetry** and **GitHub Actions** to automate version bumping and publishing to PyPI. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Automated publishing workflow |
| 8 | + |
| 9 | +### How it works |
| 10 | +- When you **merge or push to the `main` branch**, GitHub Actions will: |
| 11 | + 1. **Bump the patch version** in `pyproject.toml` |
| 12 | + 2. **Commit** the new version and **create a git tag** |
| 13 | + 3. **Build** the package |
| 14 | + 4. **Publish** the package to PyPI |
| 15 | + |
| 16 | +### Setup required |
| 17 | +1. **Create a PyPI API token**: |
| 18 | + - Log in to [pypi.org](https://pypi.org) |
| 19 | + - Go to **Account settings > API tokens** |
| 20 | + - Create a new token (preferably scoped to this project) |
| 21 | + |
| 22 | +2. **Add the token to GitHub repository secrets**: |
| 23 | + - Go to **GitHub repo > Settings > Secrets and variables > Actions** |
| 24 | + - Click **New repository secret** |
| 25 | + - Name: `PYPI_API_TOKEN` |
| 26 | + - Value: *paste your PyPI token* |
| 27 | + |
| 28 | +3. **Enable workflow permissions**: |
| 29 | + - Go to **GitHub repo > Settings > Actions > General** |
| 30 | + - Under **Workflow permissions**, select **Read and write permissions** |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Manual publishing (alternative) |
| 35 | + |
| 36 | +If you want to publish manually from your local machine: |
| 37 | + |
| 38 | +1. **Set your PyPI token as an environment variable**: |
| 39 | + |
| 40 | +```bash |
| 41 | +export POETRY_PYPI_TOKEN_PYPI=your-pypi-token |
| 42 | +``` |
| 43 | + |
| 44 | +2. **Run the Makefile target**: |
| 45 | + |
| 46 | +```bash |
| 47 | +make publish |
| 48 | +``` |
| 49 | + |
| 50 | +This will: |
| 51 | +- Bump the patch version |
| 52 | +- Build the package |
| 53 | +- Publish it to PyPI |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Notes |
| 58 | +- The automated workflow bumps **patch** version by default. You can change this in `.github/workflows/publish.yml`. |
| 59 | +- The commit message for version bump includes `[skip ci]` to avoid triggering another workflow run. |
| 60 | +- Tags are created automatically for each release. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Summary |
| 65 | +- **Merge to `main`** → **Auto bump version + tag + publish to PyPI** |
| 66 | +- **PyPI token stored securely in GitHub secrets** |
| 67 | +- **Manual publish also supported via `make publish`** |
0 commit comments