@@ -36,13 +36,20 @@ if [ -z "${PYPI_TRUSTED_PUBLISHER:-}" ]; then
3636 }
3737fi
3838
39+ # Basic upload command options
40+ upload_opts=" --verbose --skip-existing"
41+
3942# Install required packages
4043packages=" twine"
4144if [ -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
4653fi
4754python3 -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
7980fi
8081
8182echo " Uploading packages to PyPI"
0 commit comments