CheckReleaseVersion
The CheckReleaseVersion job template checks a version, which is about to be released: it has to match the version
in the Python code, and it mustn’t be released yet in a package registry. A registry refuses a second upload of the
same version, but only at the very end of a release - after the tag was created and the release page was published
and announced.
Instantiation
The following instantiation example checks a version before TriggerTaggedRelease tags it. The Prepare job
derived from job template PrepareJob version @r8 provides the version from the pull-request’s title or the tag,
the UnitTestingParams job derived from Parameters provides the package’s name and the version in its code.
PyPI is only asked on a release commit.
jobs:
Prepare:
uses: pyTooling/Actions/.github/workflows/PrepareJob.yml@r8
UnitTestingParams:
uses: pyTooling/Actions/.github/workflows/Parameters.yml@r8
with:
package_name: myPackage
VersionCheck:
uses: pyTooling/Actions/.github/workflows/CheckReleaseVersion.yml@r8
needs:
- Prepare
- UnitTestingParams
if: needs.Prepare.outputs.version != ''
with:
version: ${{ needs.Prepare.outputs.version }}
package_version: ${{ needs.UnitTestingParams.outputs.package_version }}
check_pypi_duplicate: ${{ needs.Prepare.outputs.is_release_commit }}
pypi_package: ${{ needs.UnitTestingParams.outputs.package_fullname }}
# Other pipeline jobs
TriggerTaggedRelease:
uses: pyTooling/Actions/.github/workflows/TagReleaseCommit.yml@r8
needs:
- Prepare
- VersionCheck
if: needs.Prepare.outputs.is_release_commit == 'true' && needs.VersionCheck.result == 'success'
permissions:
contents: write # required for create tag
actions: write # required for trigger workflow
with:
version: ${{ needs.Prepare.outputs.version }}
auto_tag: ${{ needs.Prepare.outputs.is_release_commit }}
secrets: inherit
See also
- TagReleaseCommit
Refuses to tag, if the tag or a release page already exists.
Parameter Summary
Goto input parameters
Parameter Name |
Required |
Type |
Default |
|---|---|---|---|
no |
string |
|
|
no |
string |
|
|
yes |
string |
— — — — |
|
no |
string |
|
|
no |
string |
|
|
no |
string |
|
|
no |
string |
|
Goto secrets
This job template needs no secrets.
Goto output parameters
This job template has no output parameters.
Input Parameters
ubuntu_image
- Type:
string
- Required:
no
- Default Value:
'ubuntu-26.04'- Possible Values:
See actions/runner-images - Available Images for available Ubuntu image versions.
- Description:
Name of the Ubuntu image used to run the jobs.
python_version
- Type:
string
- Required:
no
- Default Value:
'3.14'- Possible Values:
Any Python version provided by GitHub: actions/setup-python.
- Description:
Python version used to compare the versions.
version
- Type:
string
- Required:
yes
- Default Value:
— — — —
- Possible Values:
A version as tagged, e.g.
'v1.2.3'.- Description:
The version, which is about to be released.
package_version
- Type:
string
- Required:
no
- Default Value:
''- Possible Values:
A version as written in Python code, e.g.
'1.2.3'.- Description:
The value of
__version__in the package’s version file, as package_version provides it.
An empty string - no version file or no__version__was found - fails the check.
check_pypi_duplicate
- Type:
string
- Required:
no
- Default Value:
'false'- Possible Values:
'true'/'false'- Description:
Check that pypi_url has no release of version yet.
'true'- fail, if the registry has this release of pypi_package.
'false'- don’t query the registry.
pypi_url
- Type:
string
- Required:
no
- Default Value:
'https://pypi.org'- Possible Values:
Base URL of a package registry offering the PyPI JSON API (
<pypi_url>/pypi/<package>/<version>/json), e.g.'https://test.pypi.org'.- Description:
The package registry asked, if check_pypi_duplicate is
'true'.
pypi_package
- Type:
string
- Required:
no
- Default Value:
''- Possible Values:
Any package name in the package registry.
- Description:
Name of the package in the package registry. Required, if check_pypi_duplicate is
'true'.
Secrets
This job template needs no secrets.
Outputs
This job template has no output parameters.
Optimizations
This template offers no optimizations (reduced job runtime).