diff --git a/.github/workflows/publish_python.yml b/.github/workflows/publish_python.yml index 842b7c51..5ab3f435 100644 --- a/.github/workflows/publish_python.yml +++ b/.github/workflows/publish_python.yml @@ -118,5 +118,18 @@ jobs: TAG: ${{ github.ref_name }} run: | VERSION="${TAG#v}" - pip install --retries 10 "genkit==${VERSION}" + # PyPI's simple index lags the upload by up to a few minutes, and + # pip's --retries only covers network errors, not "no matching + # distribution". Poll until the new version resolves. + for attempt in $(seq 1 20); do + if pip install --no-cache-dir "genkit==${VERSION}"; then + break + fi + if [ "$attempt" -eq 20 ]; then + echo "genkit==${VERSION} still not installable after 10 minutes" >&2 + exit 1 + fi + echo "genkit==${VERSION} not on the index yet, retrying in 30s ($attempt/20)" + sleep 30 + done python -c "from genkit import Genkit; Genkit(); print('ok')" diff --git a/bin/create_release b/bin/create_release index fbfd3fc9..6e155912 100755 --- a/bin/create_release +++ b/bin/create_release @@ -181,5 +181,5 @@ fi echo " ✓ Published https://github.com/$REPO/releases/tag/$TAG" echo "" -echo "Next: approve the PyPI publish at https://github.com/$REPO/actions/workflows/publish_python.yml" -echo "Then verify with: pip index versions genkit" +echo "The tag push started the PyPI publish: https://github.com/$REPO/actions/workflows/publish_python.yml" +echo "Verify with: pip index versions genkit" diff --git a/docs/release_playbook.md b/docs/release_playbook.md index 93e27caf..12f36356 100644 --- a/docs/release_playbook.md +++ b/docs/release_playbook.md @@ -28,9 +28,8 @@ There is one path. `create_release` refuses to run unless every step below was f 1. `bin/bump_version X.Y.Z` on a branch from main. It bumps every `pyproject.toml` and `uv.lock`. 2. Open a PR to main titled `chore: release vX.Y.Z` or `chore(py): release Python SDK vX.Y.Z`. Its description is the release notes, published word for word. 3. Get it approved and merged. -4. `bin/create_release X.Y.Z --dry-run`, then without `--dry-run`. -5. Approve the publish at . The tag push already started it; don't run it by hand. -6. `pip index versions genkit` shows X.Y.Z. +4. `bin/create_release X.Y.Z --dry-run`, then without `--dry-run`. The tag push starts the [publish workflow](https://github.com/genkit-ai/genkit-python/actions/workflows/publish_python.yml), which uploads to PyPI with no approval step. Don't run it by hand. +5. `pip index versions genkit` shows X.Y.Z. `create_release` runs every check before it changes anything and prints a fix for each failure: @@ -72,7 +71,7 @@ Resolvers skip yanked versions unless pinned with `==`, so existing exact pins k **Two jobs:** publish → verify - **publish**: Builds all packages with `uv build`, then uploads to PyPI via `pypa/gh-action-pypi-publish`. All-or-nothing — if any build fails, the job fails. -- **verify**: `pip install genkit==` + import test. +- **verify**: `pip install genkit==` + import test. It polls for up to 10 minutes, since PyPI's index can lag the upload. ## Auth