Skip to content

Commit a11c99c

Browse files
chore(publishing): update upload scripts to use API tokens for authentication
1 parent 5d39d16 commit a11c99c

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@semantic-release/exec",
3030
{
3131
"prepareCmd": "./scripts/createdistribution.sh",
32-
"publishCmd": "./scripts/uploaddistribution_live.sh"
32+
"publishCmd": "./scripts/uploaddistribution_test.sh && ./scripts/uploaddistribution_live.sh"
3333
}
3434
],
3535
[

scripts/uploaddistribution_live.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/bash
2-
twine upload --skip-existing -u "${TWINE_LIVE_USERNAME}" -p "${TWINE_LIVE_PASSWORD}" dist/*
2+
twine upload --skip-existing -p "${TWINE_LIVE_TOKEN}" dist/*

scripts/uploaddistribution_test.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22

33
# This script uploads the distribution packages to the Test PyPI repository.
4-
# It uses the environment variables TWINE_TEST_USERNAME and TWINE_TEST_PASSWORD for authentication.
4+
# It uses the environment variables TWINE_TEST_USERNAME and TWINE_TEST_TOKEN for authentication.
55

66
# TWINE_TEST_USERNAME: The username for Test PyPI.
7-
# TWINE_TEST_PASSWORD: The password for Test PyPI.
7+
# TWINE_TEST_TOKEN: The password for Test PyPI.
8+
9+
# no user name is needed when using API tokens, so we can skip the username and just use the token for authentication.
810

911
# Increment the version number in your setup.py or pyproject.toml file before running this script.
1012
# Example for setup.py: update the version parameter in the setup() function.
1113
# Example for pyproject.toml: update the version field under [tool.poetry].
1214

13-
twine upload -u "${TWINE_TEST_USERNAME}" -p "${TWINE_TEST_PASSWORD}" --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing
15+
twine upload -p "${TWINE_TEST_TOKEN}" --repository-url https://test.pypi.org/legacy/ dist/* --skip-existing

0 commit comments

Comments
 (0)