@@ -12,14 +12,12 @@ usage() {
1212Usage: scripts/notify-registry.sh [options]
1313
1414Options:
15- --repository <pypi|test-pypi> Publish to the chosen repository (default: pypi)
16- --dry-run Build the package but skip publishing
17- -h, --help Show this help text
15+ --dry-run Build the package but skip publishing to PyPI
16+ -h, --help Show this help text
1817
1918Environment:
20- PYPI_TOKEN API token with upload rights for pypi.org (required for --repository pypi)
21- PYPI_TEST_TOKEN API token with upload rights for test.pypi.org (required for --repository test-pypi)
22- These variables can optionally be defined in .env
19+ PYPI_TOKEN API token with upload rights for pypi.org. This variable can
20+ optionally be defined in .env
2321EOF
2422}
2523
@@ -93,9 +91,6 @@ run_outside_container() {
9391 if [[ -n " ${PYPI_TOKEN:- } " ]]; then
9492 docker_args+=(-e " PYPI_TOKEN=${PYPI_TOKEN} " )
9593 fi
96- if [[ -n " ${PYPI_TEST_TOKEN:- } " ]]; then
97- docker_args+=(-e " PYPI_TEST_TOKEN=${PYPI_TEST_TOKEN} " )
98- fi
9994
10095 exec docker run " ${docker_args[@]} " " $IMAGE_NAME " bash -lc " set -euo pipefail; scripts/notify-registry.sh --inside-container \" $@ \" "
10196}
@@ -140,19 +135,10 @@ verify_versions_consistent() {
140135}
141136
142137publish_inside_container () {
143- local repository=" pypi"
144138 local dry_run=0
145139
146140 while [[ $# -gt 0 ]]; do
147141 case " $1 " in
148- --repository)
149- if [[ $# -lt 2 ]]; then
150- err " Missing value for --repository"
151- exit 1
152- fi
153- repository=$2
154- shift 2
155- ;;
156142 --dry-run)
157143 dry_run=1
158144 shift
@@ -172,30 +158,12 @@ publish_inside_container() {
172158 esac
173159 done
174160
175- case " $repository " in
176- pypi|test-pypi) ;;
177- * )
178- err " Invalid repository '${repository} '. Expected 'pypi' or 'test-pypi'."
179- exit 1
180- ;;
181- esac
182-
183- if [[ " $repository " == " pypi" ]]; then
184- load_env_var " PYPI_TOKEN"
185- if [[ -z " ${PYPI_TOKEN:- } " ]]; then
186- err " PYPI_TOKEN is not set. Export it or add it to .env before publishing."
187- exit 1
188- fi
189- export POETRY_PYPI_TOKEN_PYPI=" $PYPI_TOKEN "
190- else
191- load_env_var " PYPI_TEST_TOKEN"
192- if [[ -z " ${PYPI_TEST_TOKEN:- } " ]]; then
193- err " PYPI_TEST_TOKEN is not set. Export it or add it to .env before publishing to test-pypi."
194- exit 1
195- fi
196- export POETRY_PYPI_TOKEN_TEST_PYPI=" $PYPI_TEST_TOKEN "
197- poetry config repositories.test-pypi https://test.pypi.org/legacy/ > /dev/null
161+ load_env_var " PYPI_TOKEN"
162+ if [[ -z " ${PYPI_TOKEN:- } " ]]; then
163+ err " PYPI_TOKEN is not set. Export it or add it to .env before publishing."
164+ exit 1
198165 fi
166+ export POETRY_PYPI_TOKEN_PYPI=" $PYPI_TOKEN "
199167
200168 verify_repo_state
201169 verify_versions_consistent
@@ -208,13 +176,8 @@ publish_inside_container() {
208176 exit 0
209177 fi
210178
211- if [[ " $repository " == " pypi" ]]; then
212- poetry publish --no-interaction --no-ansi
213- err " Published package to pypi.org."
214- else
215- poetry publish --no-interaction --no-ansi -r test-pypi
216- err " Published package to test.pypi.org."
217- fi
179+ poetry publish --no-interaction --no-ansi
180+ err " Published package to pypi.org."
218181}
219182
220183main () {
0 commit comments