Skip to content

Commit fd8119b

Browse files
committed
fix: publish exact release artifacts
1 parent 6bb6ea1 commit fd8119b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

bin/release.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,21 @@ create_release() {
271271
publish_artifacts() {
272272
local version="$1"
273273
local pypi_token="${UV_PUBLISH_TOKEN:-${PYPI_TOKEN:-${PYPI_PAT_SECRET:-}}}"
274+
local artifact_prefix="${PYPI_PACKAGE//-/_}"
275+
local artifacts=("${WORKSPACE_DIR}/dist/${PYPI_PACKAGE}-${version}"*)
276+
if [[ "${artifact_prefix}" != "${PYPI_PACKAGE}" ]]; then
277+
artifacts+=("${WORKSPACE_DIR}/dist/${artifact_prefix}-${version}"*)
278+
fi
274279

275280
if curl -fsSL "https://pypi.org/pypi/${PYPI_PACKAGE}/json" | jq -e --arg version "${version}" '.releases[$version] | length > 0' >/dev/null 2>&1; then
276281
echo "${PYPI_PACKAGE} ${version} already published on PyPI"
277282
else
278283
if [[ -n "${pypi_token}" ]]; then
279-
UV_PUBLISH_TOKEN="${pypi_token}" uv publish --username=__token__ dist/*
284+
if [[ ! -e "${artifacts[0]}" ]]; then
285+
echo "Missing build artifacts for ${PYPI_PACKAGE}==${version} in ${WORKSPACE_DIR}/dist" >&2
286+
return 1
287+
fi
288+
UV_PUBLISH_TOKEN="${pypi_token}" uv publish --username=__token__ "${artifacts[@]}"
280289
else
281290
echo "Missing PyPI credentials: set UV_PUBLISH_TOKEN or PYPI_TOKEN" >&2
282291
return 1

0 commit comments

Comments
 (0)