Skip to content

Commit abcbf1f

Browse files
committed
fix: find release artifacts in repo builds
1 parent 55ccf46 commit abcbf1f

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

bin/release.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,30 @@ publish_artifacts() {
272272
local version="$1"
273273
local pypi_token="${UV_PUBLISH_TOKEN:-${PYPI_TOKEN:-${PYPI_PAT_SECRET:-}}}"
274274
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
275+
local artifacts=()
276+
local dist_dir
277+
278+
shopt -s nullglob
279+
for dist_dir in "${WORKSPACE_DIR}/dist" "${REPO_DIR}/dist"; do
280+
artifacts+=("${dist_dir}/${PYPI_PACKAGE}-${version}"*)
281+
if [[ "${artifact_prefix}" != "${PYPI_PACKAGE}" ]]; then
282+
artifacts+=("${dist_dir}/${artifact_prefix}-${version}"*)
283+
fi
284+
done
285+
shopt -u nullglob
279286

280287
if curl -fsSL "https://pypi.org/pypi/${PYPI_PACKAGE}/json" | jq -e --arg version "${version}" '.releases[$version] | length > 0' >/dev/null 2>&1; then
281288
echo "${PYPI_PACKAGE} ${version} already published on PyPI"
282289
else
283290
if [[ -n "${pypi_token}" ]]; then
284-
if [[ ! -e "${artifacts[0]}" ]]; then
285-
echo "Missing build artifacts for ${PYPI_PACKAGE}==${version} in ${WORKSPACE_DIR}/dist" >&2
291+
if [[ "${#artifacts[@]}" -eq 0 ]]; then
292+
echo "Missing build artifacts for ${PYPI_PACKAGE}==${version}" >&2
286293
return 1
287294
fi
288295
UV_PUBLISH_TOKEN="${pypi_token}" uv publish --username=__token__ "${artifacts[@]}"
289296
elif [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
290-
if [[ ! -e "${artifacts[0]}" ]]; then
291-
echo "Missing build artifacts for ${PYPI_PACKAGE}==${version} in ${WORKSPACE_DIR}/dist" >&2
297+
if [[ "${#artifacts[@]}" -eq 0 ]]; then
298+
echo "Missing build artifacts for ${PYPI_PACKAGE}==${version}" >&2
292299
return 1
293300
fi
294301
uv publish --trusted-publishing always "${artifacts[@]}"

0 commit comments

Comments
 (0)