2019-08-23 19:13:19 +08:00
|
|
|
#! /usr/bin/env bash
|
2019-08-21 04:48:52 +08:00
|
|
|
set -Eeuo pipefail
|
|
|
|
|
2019-09-12 20:38:56 +08:00
|
|
|
|
2022-07-25 23:29:21 +08:00
|
|
|
echo \
|
|
|
|
::warning file='# >>' PyPA publish to PyPI GHA'%3A' \
|
|
|
|
UNSUPPORTED GITHUB ACTION VERSION \
|
|
|
|
'<< ':: \
|
|
|
|
You are using '"pypa/gh-action-pypi-publish@master"'. \
|
|
|
|
The '"master"' branch of this project has been sunset and will not \
|
|
|
|
receive any updates, not even security bug fixes. Please, make \
|
|
|
|
sure to use a supported version. If you want to pin to v1 major \
|
|
|
|
version, use '"pypa/gh-action-pypi-publish@release/v1"'. If you \
|
|
|
|
feel adventurous, you may opt to use use \
|
|
|
|
'"pypa/gh-action-pypi-publish@unstable/v1"' instead. A more \
|
|
|
|
general recommendation is to pin to exact tags or commit shas.
|
|
|
|
|
|
|
|
|
2019-09-12 20:38:56 +08:00
|
|
|
if [[
|
|
|
|
"$INPUT_USER" == "__token__" &&
|
|
|
|
! "$INPUT_PASSWORD" =~ ^pypi-
|
|
|
|
]]
|
|
|
|
then
|
2020-06-04 07:06:14 +08:00
|
|
|
echo \
|
2020-06-04 07:23:32 +08:00
|
|
|
::warning file='# >>' PyPA publish to PyPI GHA'%3A' \
|
|
|
|
POTENTIALLY INVALID TOKEN \
|
|
|
|
'<< ':: \
|
2019-09-12 20:38:56 +08:00
|
|
|
It looks like you are trying to use an API token to \
|
|
|
|
authenticate in the package index and your token value does \
|
|
|
|
not start with '"pypi-"' as it typically should. This may \
|
|
|
|
cause an authentication error. Please verify that you have \
|
|
|
|
copied your token properly if such an error occurs.
|
|
|
|
fi
|
|
|
|
|
2020-06-28 17:43:30 +08:00
|
|
|
if ( ! ls -A ${INPUT_PACKAGES_DIR%%/}/*.tar.gz &> /dev/null && \
|
|
|
|
! ls -A ${INPUT_PACKAGES_DIR%%/}/*.whl &> /dev/null )
|
2019-09-12 23:53:53 +08:00
|
|
|
then
|
2020-06-04 07:06:14 +08:00
|
|
|
echo \
|
2020-06-04 07:23:32 +08:00
|
|
|
::warning file='# >>' PyPA publish to PyPI GHA'%3A' \
|
|
|
|
MISSING DISTS \
|
|
|
|
'<< ':: \
|
2019-09-16 19:01:16 +08:00
|
|
|
It looks like there are no Python distribution packages to \
|
2020-06-04 07:21:51 +08:00
|
|
|
publish in the directory "'${INPUT_PACKAGES_DIR%%/}/'". \
|
2020-06-04 07:06:14 +08:00
|
|
|
Please verify that they are in place should you face this \
|
|
|
|
problem.
|
2019-09-12 23:53:53 +08:00
|
|
|
fi
|
|
|
|
|
2020-06-03 23:04:52 +08:00
|
|
|
if [[ ${INPUT_VERIFY_METADATA,,} != "false" ]] ; then
|
2020-06-03 23:40:16 +08:00
|
|
|
twine check ${INPUT_PACKAGES_DIR%%/}/*
|
2020-06-02 23:08:43 +08:00
|
|
|
fi
|
|
|
|
|
2020-06-20 03:30:53 +08:00
|
|
|
TWINE_EXTRA_ARGS=
|
|
|
|
if [[ ${INPUT_SKIP_EXISTING,,} != "false" ]] ; then
|
|
|
|
TWINE_EXTRA_ARGS=--skip-existing
|
|
|
|
fi
|
|
|
|
|
2020-09-26 06:42:02 +08:00
|
|
|
if [[ ${INPUT_VERBOSE,,} != "false" ]] ; then
|
2020-09-15 12:31:21 +08:00
|
|
|
TWINE_EXTRA_ARGS="--verbose $TWINE_EXTRA_ARGS"
|
|
|
|
fi
|
2019-09-12 20:38:56 +08:00
|
|
|
|
2022-01-09 07:05:27 +08:00
|
|
|
if [[ ${INPUT_PRINT_HASH,,} != "false" || ${INPUT_VERBOSE,,} != "false" ]] ; then
|
2022-01-13 12:50:40 +08:00
|
|
|
python /app/print-hash.py ${INPUT_PACKAGES_DIR%%/}
|
2022-01-08 12:12:15 +08:00
|
|
|
fi
|
|
|
|
|
2019-08-23 19:17:10 +08:00
|
|
|
TWINE_USERNAME="$INPUT_USER" \
|
|
|
|
TWINE_PASSWORD="$INPUT_PASSWORD" \
|
|
|
|
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
|
2020-06-20 03:30:53 +08:00
|
|
|
exec twine upload ${TWINE_EXTRA_ARGS} ${INPUT_PACKAGES_DIR%%/}/*
|