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.
35 lines
1.3 KiB
Bash
35 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Exercise the release checks without a GitHub token or a PyPI upload.
|
|
stable='{"tag_name":"v0.42.0","draft":false,"prerelease":false,"published_at":"2026-01-01T00:00:00Z"}'
|
|
protected='{"protection_rules":[{"type":"required_reviewers","reviewers":[{"type":"Team"}]}]}'
|
|
gh() {
|
|
case "$2" in
|
|
repos/lancedb/lancedb/releases/tags/*) [[ -n $release_json ]] && echo "$release_json" ;;
|
|
repos/lancedb/lancedb/environments/pypi-cli) [[ -n $environment_json ]] && echo "$environment_json" ;;
|
|
*) return 1 ;;
|
|
esac
|
|
}
|
|
export -f gh
|
|
check() {
|
|
release_json=$2 environment_json=$3 bash ci/cli_wheel/check_publish.sh "$1"
|
|
}
|
|
reject() {
|
|
if check "$@" 2>/dev/null; then
|
|
echo "Unexpectedly accepted: $*" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check v0.42.0 "$stable" "$protected"
|
|
reject v0.42.0-beta.30 "${stable/v0.42.0/v0.42.0-beta.30}" "$protected"
|
|
reject v0.42.1 "$stable" "$protected"
|
|
reject v0.42.0 "" "$protected"
|
|
reject v0.42.0 "$(jq '.draft = true' <<<"$stable")" "$protected"
|
|
reject v0.42.0 "$(jq '.prerelease = true' <<<"$stable")" "$protected"
|
|
reject v0.42.0 "$(jq '.published_at = null' <<<"$stable")" "$protected"
|
|
reject v0.42.0 "$stable" '{"protection_rules":[]}'
|
|
reject v0.42.0 "$stable" ""
|
|
reject v0.42.0 "$stable" '{"protection_rules":[{"type":"required_reviewers","reviewers":[]}]}'
|