From 35098e55a41f37ad67bcc6170256c7809cfccaa9 Mon Sep 17 00:00:00 2001 From: AsifNawaz-cnic Date: Thu, 26 Mar 2026 16:52:21 +0100 Subject: [PATCH] chore(publishing): update upload scripts to use API tokens for authentication --- .releaserc.json | 2 +- scripts/uploaddistribution_live.sh | 2 +- scripts/uploaddistribution_test.sh | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.releaserc.json b/.releaserc.json index a6a7652..d6149dc 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -29,7 +29,7 @@ "@semantic-release/exec", { "prepareCmd": "./scripts/createdistribution.sh", - "publishCmd": "./scripts/uploaddistribution_live.sh" + "publishCmd": "./scripts/uploaddistribution_test.sh && ./scripts/uploaddistribution_live.sh" } ], [ diff --git a/scripts/uploaddistribution_live.sh b/scripts/uploaddistribution_live.sh index 970ffc9..cbc1337 100755 --- a/scripts/uploaddistribution_live.sh +++ b/scripts/uploaddistribution_live.sh @@ -1,2 +1,2 @@ #!/bin/bash -twine upload --skip-existing -u "${TWINE_LIVE_USERNAME}" -p "${TWINE_LIVE_PASSWORD}" dist/* +twine upload --skip-existing -p "${TWINE_LIVE_TOKEN}" dist/* diff --git a/scripts/uploaddistribution_test.sh b/scripts/uploaddistribution_test.sh index 4df4cb2..be47db8 100755 --- a/scripts/uploaddistribution_test.sh +++ b/scripts/uploaddistribution_test.sh @@ -1,13 +1,15 @@ #!/bin/bash # This script uploads the distribution packages to the Test PyPI repository. -# It uses the environment variables TWINE_TEST_USERNAME and TWINE_TEST_PASSWORD for authentication. +# It uses the environment variables TWINE_TEST_USERNAME and TWINE_TEST_TOKEN for authentication. # TWINE_TEST_USERNAME: The username for Test PyPI. -# TWINE_TEST_PASSWORD: The password for Test PyPI. +# TWINE_TEST_TOKEN: The password for Test PyPI. + +# no user name is needed when using API tokens, so we can skip the username and just use the token for authentication. # Increment the version number in your setup.py or pyproject.toml file before running this script. # Example for setup.py: update the version parameter in the setup() function. # Example for pyproject.toml: update the version field under [tool.poetry]. -twine upload -u "${TWINE_TEST_USERNAME}" -p "${TWINE_TEST_PASSWORD}" --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing \ No newline at end of file +twine upload -p "${TWINE_TEST_TOKEN}" --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing \ No newline at end of file