|
1 | 1 | # Releasing `kratix-sdk` |
2 | 2 |
|
3 | | -This document captures the steps for cutting a new version of the SDK and publishing it to PyPI. |
4 | | - |
5 | | -1. **Set up Poetry credentials (one-time per machine)** |
6 | | - ```bash |
7 | | - poetry config repositories.testpypi https://test.pypi.org/legacy/ |
8 | | - # Use a TestPyPI API token copied from https://test.pypi.org/manage/account/token/ |
9 | | - poetry config pypi-token.testpypi <TESTPYPI_API_TOKEN> |
10 | | - # For the main PyPI token (if not already configured) |
11 | | - poetry config pypi-token.pypi <PYPI_API_TOKEN> |
12 | | - ``` |
13 | | - Alternatively export `POETRY_HTTP_BASIC_TESTPYPI_USERNAME="__token__"` and `POETRY_HTTP_BASIC_TESTPYPI_PASSWORD="<token>"` before publishing. |
14 | | - |
15 | | -2. **Prep the repo** |
16 | | - - Prior to pypi release, release-please has to manage / generate a new version number. |
17 | | - - All commits should be merged to `main`. |
18 | | - - Once release-please has created a PR, merge it to `main` with the new version number in `pyproject.toml` . |
19 | | - - Pull down the latest `main` branch. |
20 | | - |
21 | | -3. **Run quality checks** |
22 | | - ```bash |
23 | | - make install # installs dependencies |
24 | | - make fmt && make lint # optional but recommended |
25 | | - make test # run pytest |
26 | | - ``` |
27 | | - |
28 | | -4. **Build distributions** |
29 | | - ```bash |
30 | | - poetry build |
31 | | - ls dist/ # verify the wheel and sdist exist |
32 | | - tar tf dist/kratix-sdk-<version>.tar.gz | head |
33 | | - ``` |
34 | | - Inspect the contents to ensure only expected files are included. |
35 | | - |
36 | | -5. **Publish to TestPyPI (recommended)** |
37 | | - ```bash |
38 | | - poetry publish --repository testpypi --build |
39 | | - python -m venv /tmp/kratix-sdk-test |
40 | | - source /tmp/kratix-sdk-test/bin/activate |
41 | | - pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple kratix-sdk==<version> |
42 | | - ``` |
43 | | - Run a quick smoke test (`python -c "import kratix_sdk; print(kratix_sdk.__version__)"`) to ensure the build works. |
44 | | - |
45 | | -6. **Publish to PyPI** |
46 | | - ```bash |
47 | | - poetry publish --build |
48 | | - git tag v<version> |
49 | | - git push origin main --tags |
50 | | - ``` |
51 | | - PyPI credentials/API token must be configured in `~/.pypirc` beforehand. |
52 | | - |
53 | | -7. **Communicate the release** |
54 | | - - Share release notes on the relevant channels. |
55 | | - - Update downstream sample projects if they pin versions. |
| 3 | +The release process for this repository is almost entirely automated, consisting |
| 4 | +of these steps: |
| 5 | + |
| 6 | +1. **Run quality checks (unit tests and linting)** (automated) |
| 7 | + |
| 8 | +Every PR and every merge to `main` will trigger the testing workflow. This |
| 9 | +workflow checks for successful unit test runs and whether the linting and |
| 10 | +formatting rules are being respected. |
| 11 | + |
| 12 | +1. **Prepare the release PR** (automated) |
| 13 | + |
| 14 | +`release-please` will prepare a release PR for this project after each each |
| 15 | +successful run of the of the quality checks in the `main` branch. |
| 16 | + |
| 17 | +1. **Merge the release PR** (manual) |
| 18 | + |
| 19 | +A maintainer decided whether the release PR created by `release-please` should |
| 20 | +be merged. If a release PR is merged, `release-please` will update the |
| 21 | +[CHANGELOG](CHANGELOG.md) and create a new Github Release with notes. |
| 22 | + |
| 23 | +1. **Publish repositories to PyPI** (automated) |
| 24 | + |
| 25 | +When a release is created, the publish workflow will package the code onto a |
| 26 | +new release and push this release as a new package on PyPI. If the package is |
| 27 | +published successfully, it will publish the API documentation to the |
| 28 | +[documentation website](https://syntasso.github.io/kratix-python/). |
| 29 | + |
| 30 | +1. **Communicate the release** (manual) |
| 31 | + |
| 32 | +After all artifacts are published, a human needs to: |
| 33 | +- Share release notes on the relevant channels. |
| 34 | +- Update downstream sample projects if they pin versions. |
0 commit comments