This workflow will build the package using the
hynek/build-and-inspect-python-package
action, upload the package to TestPyPI, and then verify that the package
can be installed from TestPyPI.
In order to ensure each version uploaded to TestPyPI is unique, the
workflow will first create a unique .postN
version number for the package on top of the
officially released version of the package, incrementing N
each time the workflow runs.
Important
When calling this reusable workflow, the permissions must be set as follows:
permissions:
contents: read
id-token: write
attestations: write
Note
This workflow uses concurrency to limit the number of builds that can run at the same time
to a single build. This concurrency is shared across the 'pypi (Reusable Workflows)'
concurrency
group within the repo that calls this workflow.
Note
This workflow uses the following GitHub Actions:
- actions/checkout
- tektronix/python-package-ci-cd/actions/create_unique_testpypi_version
- hynek/build-and-inspect-python-package
- actions/download-artifact
- pypa/gh-action-pypi-publish
- actions/setup-python
- nick-fields/retry
See the Workflow file for the currently used versions of each GitHub Action.
Tip
See the Workflow file for implementation details.
Input variable | Necessity | Description | Default |
---|---|---|---|
package-name |
required | The name of the package to build, upload, and install. | |
repo-name |
required | The full name of the repository to use to gate uploads, in the format owner/repo . |
name: Publish to TestPyPI
on:
push:
branches: [main]
concurrency: # This concurrency is not required, but can be added if extra control of concurrent builds is required
group: pypi
jobs:
package-testpypi:
uses: tektronix/python-package-ci-cd/.github/workflows/_reusable-package-testpypi.yml@v0.0.1
with:
package-name: my-package # required
repo-name: owner/my-package # required
permissions:
contents: read
id-token: write
attestations: write