Skip to content

Commit 2690789

Browse files
authored
fix: PyPI attentions are incorrectly always uploaded (#1707)
1 parent 40ff5ce commit 2690789

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

bin/publib-pypi

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,20 @@ if [ -z "${PYPI_TRUSTED_PUBLISHER:-}" ]; then
3636
}
3737
fi
3838

39+
# Basic upload command options
40+
upload_opts="--verbose --skip-existing"
41+
3942
# Install required packages
4043
packages="twine"
4144
if [ -n "${PYPI_TRUSTED_PUBLISHER:-}" ]; then
4245
packages="$packages id"
43-
fi
44-
if [ -z "${PYPI_DISABLE_ATTESTATIONS:-}" ]; then
45-
packages="$packages pypi-attestations"
46+
47+
if [ -z "${PYPI_DISABLE_ATTESTATIONS:-}" ]; then
48+
# add attestations package
49+
packages="$packages pypi-attestations"
50+
# add attestations opt to upload command
51+
upload_opts="$upload_opts --attestations"
52+
fi
4653
fi
4754
python3 -m pip install --user --upgrade $packages
4855

@@ -65,17 +72,11 @@ if [ -n "${PYPI_TRUSTED_PUBLISHER:-}" ]; then
6572

6673
export TWINE_USERNAME="__token__"
6774
export TWINE_PASSWORD="$api_token"
68-
fi
69-
70-
if [ -z "${PYPI_DISABLE_ATTESTATIONS:-}" ]; then
71-
echo "Signing packages with pypi-attestations"
72-
python3 -m pypi_attestations sign *
73-
fi
7475

75-
# Build upload command with optional attestations
76-
upload_opts="--verbose --skip-existing"
77-
if [ -z "${PYPI_DISABLE_ATTESTATIONS:-}" ]; then
78-
upload_opts="$upload_opts --attestations"
76+
if [ -z "${PYPI_DISABLE_ATTESTATIONS:-}" ]; then
77+
echo "Signing packages with pypi-attestations"
78+
python3 -m pypi_attestations sign *
79+
fi
7980
fi
8081

8182
echo "Uploading packages to PyPI"

0 commit comments

Comments
 (0)