Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/CompletePipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ on:
required: false
default: 'true'
type: string
pypi_dry_run:
description: 'Validate the packages with twine, but do not upload them to PyPI.'
required: false
default: 'false'
type: string
cleanup:
description: 'Cleanup artifacts afterwards.'
required: false
Expand Down Expand Up @@ -537,6 +542,7 @@ jobs:
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
requirements: '-r dist/requirements.txt'
artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }}
dry_run: ${{ inputs.pypi_dry_run }}
cleanup: ${{ inputs.cleanup }}
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/PublishOnPyPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ on:
description: 'Name of the package artifact.'
required: true
type: string
dry_run:
description: 'Validate the packages with twine, but do not upload them to PyPI.'
required: false
default: 'false'
type: string
cleanup:
description: 'Cleanup artifacts afterwards.'
required: false
Expand Down Expand Up @@ -74,13 +79,19 @@ jobs:
- name: ⚙ Install dependencies for packaging and release
run: python -m pip install --disable-pip-version-check ${{ inputs.requirements }}

- name: 🔎 Check Python packages instead of publishing them
if: inputs.dry_run == 'true'
run: twine check dist/*.whl dist/*.tar.gz

- name: ⤴ Publish Python wheel package to PyPI
if: inputs.dry_run != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*.whl

- name: ⤴ Publish Python source package to PyPI
if: inputs.dry_run != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
Expand Down
19 changes: 19 additions & 0 deletions doc/JobTemplate/AllInOne/CompletePipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ Parameter Summary
+--------------------------------------------------------------------+----------+--------+----------------------------------------------------------------------------+
| :ref:`JOBTMPL/CompletePipeline/Input/dorny` | no | string | ``'false'`` |
+--------------------------------------------------------------------+----------+--------+----------------------------------------------------------------------------+
| :ref:`JOBTMPL/CompletePipeline/Input/pypi_dry_run` | no | string | ``'false'`` |
+--------------------------------------------------------------------+----------+--------+----------------------------------------------------------------------------+
| :ref:`JOBTMPL/CompletePipeline/Input/cleanup` | no | string | ``'true'`` |
+--------------------------------------------------------------------+----------+--------+----------------------------------------------------------------------------+

Expand Down Expand Up @@ -932,6 +934,23 @@ auto_tag
``'false'`` - never tag automatically.


.. _JOBTMPL/CompletePipeline/Input/pypi_dry_run:

pypi_dry_run
============

:Type: string
:Required: no
:Default Value: ``'false'``
:Possible Values: ``'true'`` / ``'false'``
:Description: Validate the built packages with ``twine check`` instead of uploading them to :term:`PyPI`.
Forwarded to :ref:`JOBTMPL/PublishOnPyPI/Input/dry_run`. |br|
Intended for a pipeline that builds a package which is never published - a fixture used to
exercise the job templates, or a fork that must not push to the upstream project's PyPI name. |br|
``'true'`` - check the packages and publish nothing. |br|
``'false'`` - publish the packages.


.. _JOBTMPL/CompletePipeline/Input/cleanup:

cleanup
Expand Down
21 changes: 21 additions & 0 deletions doc/JobTemplate/Package/PublishOnPyPI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Publish a wheel (``*.whl``) packages and/or source (``*.tar.gz``) package to :te
(:ref:`JOBTMPL/PublishOnPyPI/Input/requirements`), which must provide :term:`twine`.
3. Publish the wheel package(s) (:file:`*.whl`).
4. Publish the source package(s) (:file:`*.tar.gz`).

Steps 3 and 4 are replaced by a ``twine check`` of both package kinds if
:ref:`JOBTMPL/PublishOnPyPI/Input/dry_run` is enabled.
5. Delete the artifact (:ref:`JOBTMPL/PublishOnPyPI/Input/cleanup`).

.. topic:: Preconditions
Expand Down Expand Up @@ -125,6 +128,8 @@ Parameter Summary
+---------------------------------------------------------+----------+--------+-------------------+
| :ref:`JOBTMPL/PublishOnPyPI/Input/artifact` | yes | string | — — — — |
+---------------------------------------------------------+----------+--------+-------------------+
| :ref:`JOBTMPL/PublishOnPyPI/Input/dry_run` | no | string | ``'false'`` |
+---------------------------------------------------------+----------+--------+-------------------+
| :ref:`JOBTMPL/PublishOnPyPI/Input/cleanup` | no | string | ``'true'`` |
+---------------------------------------------------------+----------+--------+-------------------+

Expand Down Expand Up @@ -182,6 +187,22 @@ artifact
:Description: Name of the artifact containing the packaged Python package(s).


.. _JOBTMPL/PublishOnPyPI/Input/dry_run:

dry_run
=======

:Type: string
:Required: no
:Default Value: ``'false'``
:Possible Values: ``'true'`` / ``'false'``
:Description: Validate the packages with ``twine check`` instead of uploading them to :term:`PyPI`. |br|
Everything up to the upload still runs, so the artifact download, the Python setup and the package
metadata are exercised - only the two ``twine upload`` calls are skipped. |br|
``'true'`` - check the packages and publish nothing. |br|
``'false'`` - publish the packages.


.. _JOBTMPL/PublishOnPyPI/Input/cleanup:

cleanup
Expand Down
Loading