File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ publish_to_pypi
1111}
1212
1313check_required_vars () {
14- REQUIRED_VARS=( " TWINE_USERNAME"
15- " TWINE_PASSWORD" )
14+ REQUIRED_VARS=( " TWINE_API_KEY" )
1615
1716 for required_var in " ${REQUIRED_VARS[@]} " ; do
1817 if [[ " ${! required_var} " == " " ]]; then
@@ -51,8 +50,7 @@ publish_to_pypi() {
5150 docker run --rm \
5251 -t \
5352 -e TWINE_REPOSITORY_URL \
54- -e TWINE_USERNAME \
55- -e TWINE_PASSWORD \
53+ -e TWINE_API_KEY \
5654 conjur-api-python3-publish bash -exc "
5755 echo 'Installing new versions of pip and wheel...'
5856 /venv/bin/pip3 install --upgrade pip wheel
@@ -63,8 +61,14 @@ publish_to_pypi() {
6361 echo 'Testing artifacts in dist/*'
6462 /venv/bin/twine check dist/*
6563
66- echo 'Publishing package to '\$ TWINE_REPOSITORY_URL' using account '\$ TWINE_USERNAME'...'
67- /venv/bin/twine upload --skip-existing --repository-url $TWINE_REPOSITORY_URL dist/*
64+ # See https://pypi.org/help/: 'How can I use API tokens to authenticate with PyPI?'
65+ echo 'Publishing package to '\$ TWINE_REPOSITORY_URL' using API token...'
66+ /venv/bin/twine upload \
67+ --skip-existing \
68+ --repository-url $TWINE_REPOSITORY_URL \
69+ --username __token__ \
70+ --password $TWINE_API_KEY \
71+ dist/*
6872 "
6973}
7074
Original file line number Diff line number Diff line change 22 ADMIN_PASSWORD : !var ci/generics/conjur-admin-password
33
44production :
5- TWINE_USERNAME : !var ecosystems/pypi/users/conjur/username
6- TWINE_PASSWORD : !var ecosystems/pypi/users/conjur/password
5+ TWINE_API_KEY : !var ecosystems/pypi/users/conjur/apikey
76
87# https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives
98# NOTE: Sometimes, test PyPI wipes their DB so re-registration will be needed
109testing :
11- TWINE_USERNAME : !var ecosystems/pypi/test-users/conjur/username
12- TWINE_PASSWORD : !var ecosystems/pypi/test-users/conjur/password
10+ TWINE_API_KEY : !var ecosystems/pypi/test-users/conjur/apikey
You can’t perform that action at this time.
0 commit comments