|
| 1 | +# Release Process for cli-code-agent |
| 2 | + |
| 3 | +This document outlines the steps to release new versions of the `cli-code-agent` package to PyPI. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. GitHub repository access with permissions to push tags and create releases |
| 8 | +2. PyPI account with permissions to publish the package |
| 9 | + |
| 10 | +## Setup |
| 11 | + |
| 12 | +### 1. Configure PyPI API Token |
| 13 | + |
| 14 | +You can use either Trusted Publishing (OIDC) or a PyPI API token for publishing: |
| 15 | + |
| 16 | +#### Option A: API Token (Simpler) |
| 17 | + |
| 18 | +1. Generate a PyPI API token: |
| 19 | + - Go to https://pypi.org/manage/account/ |
| 20 | + - Navigate to API tokens and create a new token with scope limited to the `cli-code-agent` project |
| 21 | + - Copy the token value (it will only be shown once) |
| 22 | + |
| 23 | +2. Add the token to GitHub repository secrets: |
| 24 | + - Go to your GitHub repository → Settings → Secrets and variables → Actions |
| 25 | + - Create a new repository secret named `PYPI_API_TOKEN` |
| 26 | + - Paste the PyPI token value |
| 27 | + |
| 28 | +#### Option B: Trusted Publishing (More Secure) |
| 29 | + |
| 30 | +Set up Trusted Publishing between GitHub and PyPI: |
| 31 | + |
| 32 | +1. On PyPI: |
| 33 | + - Go to your project page |
| 34 | + - Navigate to "Settings" → "Publishing" |
| 35 | + - Add a new "Pending publisher" |
| 36 | + - Select GitHub as the workflow |
| 37 | + - Enter `BlueCentre/cli-code` as the owner/repo |
| 38 | + - Enter `.github/workflows/python-ci.yml` as the workflow name |
| 39 | + - Save the publisher |
| 40 | + |
| 41 | +2. On GitHub: |
| 42 | + - Create an environment named `publish` in your repository settings |
| 43 | + - Set the environment variable `USE_TRUSTED_PUBLISHING=true` |
| 44 | + |
| 45 | +### 2. Creating a Release |
| 46 | + |
| 47 | +1. Update version in `pyproject.toml`: |
| 48 | + ```toml |
| 49 | + version = "x.y.z" # Update this line |
| 50 | + ``` |
| 51 | + |
| 52 | +2. Commit the version change: |
| 53 | + ```bash |
| 54 | + git add pyproject.toml |
| 55 | + git commit -m "Bump version to x.y.z" |
| 56 | + ``` |
| 57 | + |
| 58 | +3. Create and push a tag: |
| 59 | + ```bash |
| 60 | + git tag -a vx.y.z -m "Release version x.y.z" |
| 61 | +git push origin main |
| 62 | +git push origin vx.y.z |
| 63 | + ``` |
| 64 | + |
| 65 | +4. Monitor the CI workflow in GitHub Actions to verify the release process completes successfully. |
| 66 | + |
| 67 | +5. Check that the package appears on PyPI at https://pypi.org/project/cli-code-agent/ |
| 68 | + |
| 69 | +## Troubleshooting |
| 70 | + |
| 71 | +If the release fails, check: |
| 72 | + |
| 73 | +1. GitHub Actions logs for error messages |
| 74 | +2. Verify that the tag format is correct (should start with 'v') |
| 75 | +3. Ensure the PyPI token has not expired |
| 76 | +4. Verify that the package version is unique (PyPI rejects duplicate versions) |
0 commit comments