CI: Add publishing tox target environment 08/71508/6
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 5 Apr 2023 17:53:53 +0000 (10:53 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 5 Apr 2023 22:20:56 +0000 (15:20 -0700)
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Change-Id: I6b097ae249d83528a85f4d69fd88b82845c20dcf

tox.ini

diff --git a/tox.ini b/tox.ini
index 796e955..e9358b4 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -75,3 +75,22 @@ deps =
     -r{toxinidir}/requirements.txt
     -r{toxinidir}/test-requirements.txt
 commands = reno {posargs:--help}
+
+
+[testenv:publish]
+description =
+    Publish the package you have been developing to a package index server.
+    By default, it uses testpypi. If you really want to publish your package
+    to be publicly accessible in PyPI, use the `-- --repository pypi` option.
+skip_install = True
+changedir = {toxinidir}
+passenv =
+    # See: https://twine.readthedocs.io/en/latest/
+    TWINE_USERNAME
+    TWINE_PASSWORD
+    TWINE_REPOSITORY
+    TWINE_REPOSITORY_URL
+deps = twine
+commands =
+    python -m twine check dist/*
+    python -m twine upload {posargs:--repository {env:TWINE_REPOSITORY:testpypi}} dist/*