mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
The CLI workflow added in #5214 builds and tests `lancedb-tools` wheels, but release maintainers still need a way to publish them to PyPI. This adds an opt-in upload for published stable releases. A maintainer starts the workflow from `main` with the release tag, then a required reviewer approves the upload after the native install tests pass. This was accomplished with the following changes: - Check the GitHub release and the required reviewer configuration on `pypi-cli` before requesting deployment. - Use PyPI Trusted Publishing to upload the three tested wheels from the same run and verify their public SHA-256 digests. A retry can finish a partial upload. - Document the dispatch command and the one-time GitHub environment and PyPI publisher setup. ### Testing Added tests for a published stable release, mismatched and beta tags, draft or missing releases, and missing reviewer protection. PR runs also exercise the beta wheels with `uvx` and `pipx` across all three supported platforms. The first production upload requires the configured publisher and an approved stable release.
26 lines
911 B
Bash
26 lines
911 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
tag=${1:?pass the stable release tag}
|
|
number='(0|[1-9][0-9]*)'
|
|
if ! [[ $tag =~ ^v${number}\.${number}\.${number}$ ]]; then
|
|
echo "Expected a stable release tag such as v0.42.0, got $tag" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! gh api "repos/lancedb/lancedb/releases/tags/$tag" |
|
|
jq -e --arg tag "$tag" '
|
|
.tag_name == $tag and .draft == false and .prerelease == false and
|
|
(.published_at | type == "string" and length > 0)
|
|
' >/dev/null; then
|
|
echo "Expected a published stable GitHub release for $tag" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Referencing a missing GitHub environment would create it without protection.
|
|
if ! gh api repos/lancedb/lancedb/environments/pypi-cli |
|
|
jq -e 'any(.protection_rules[]; .type == "required_reviewers" and (.reviewers | length > 0))' >/dev/null; then
|
|
echo "Configure a required reviewer on the pypi-cli environment" >&2
|
|
exit 1
|
|
fi
|