Skip to content

Commit 68276eb

Browse files
authored
Merge pull request #167 from trail-of-forks/tob-nudge
2 parents 54d67ed + e90e853 commit 68276eb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

twine-upload.sh

+14
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ INPUT_VERIFY_METADATA="$(get-normalized-input 'verify-metadata')"
4040
INPUT_SKIP_EXISTING="$(get-normalized-input 'skip-existing')"
4141
INPUT_PRINT_HASH="$(get-normalized-input 'print-hash')"
4242

43+
TRUSTED_PUBLISHING_NUDGE="::warning title=Upgrade to Trusted Publishing::\
44+
Trusted Publishers allows publishing packages to PyPI from automated \
45+
environments like GitHub Actions without needing to use username/password \
46+
combinations or API tokens to authenticate with PyPI. Read more: \
47+
https://docs.pypi.org/trusted-publishers"
48+
4349
if [[ "${INPUT_USER}" == "__token__" && -z "${INPUT_PASSWORD}" ]] ; then
4450
# No password supplied by the user implies that we're in the OIDC flow;
4551
# retrieve the OIDC credential and exchange it for a PyPI API token.
@@ -53,10 +59,18 @@ elif [[ "${INPUT_USER}" == '__token__' ]]; then
5359
echo \
5460
'::notice::Using a user-provided API token for authentication' \
5561
"against ${INPUT_REPOSITORY_URL}"
62+
63+
if [[ "${INPUT_REPOSITORY_URL}" =~ pypi\.org ]]; then
64+
echo "${TRUSTED_PUBLISHING_NUDGE}"
65+
fi
5666
else
5767
echo \
5868
'::notice::Using a username + password pair for authentication' \
5969
"against ${INPUT_REPOSITORY_URL}"
70+
71+
if [[ "${INPUT_REPOSITORY_URL}" =~ pypi\.org ]]; then
72+
echo "${TRUSTED_PUBLISHING_NUDGE}"
73+
fi
6074
fi
6175

6276
if [[

0 commit comments

Comments
 (0)