Release actions#
Release actions provide for releasing the various artifacts of a Python library.
These actions assume that you have used the Documentation actions and the Build actions. The reason is that the artifacts generated during these actions are the ones to be released.
Release PyPI private action#
Release library artifacts to the PyAnsys private index. Use the
PYANSYS_PRIVATE_PYPI_TOKEN
as the token. Artifacts get downloaded from the
CI/CD pipeline and are assumed to be named <library-name>-artifacts
. This
file is expected to contain a wheel and a source distribution file for the
desired library.
Input |
Description |
Required |
Type |
Default |
---|---|---|---|---|
library-name |
Name of the Python library to be published. |
True |
string |
|
twine-username |
User name used when uploading to the PyAnsys private index. |
False |
string |
__token__ |
twine-token |
Password used when uploading to the PyAnsys private index. |
False |
string |
|
use-trusted-publisher |
Whether to use the OIDC token for releasing. Default value is Note
|
False |
boolean |
False |
dry-run |
Whether to run or not this action in testing mode. Testing mode executes
all the action steps except the releasing artifacts one. This allows
developers to verify the health of the action once integrated in their
CI/CD pipelines without actually publishing artifacts. Default value is
|
False |
boolean |
False |
skip-existing |
Continue uploading files if one already exists. Only valid when uploading to PyPI. Other implementations may not support this. |
False |
boolean |
True |
python-version |
Python version for installing and using twine. |
False |
string |
3.10 |
index-name |
The name of the index endpoint used for uploading the artifacts. |
True |
string |
https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload |
Examples#
Release to private PyPI
release-pypi-private:
name: "Release to private PyPI"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the private PyPI repository"
uses: ansys/actions/release-pypi-private@v8.1
with:
library-name: "ansys-<product>-<library>"
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
Release PyPI test action#
Release library artifacts to the Test PyPI public index. Use the
PYANSYS_PYPI_TEST_PAT
as the token. Artifacts get downloaded from the
CI/CD pipeline and are assumed to be named <library-name>-artifacts
. This
file is expected to contain a wheel file and a source distribution file for
the desired library.
Input |
Description |
Required |
Type |
Default |
---|---|---|---|---|
library-name |
Name of the Python library to be published. |
True |
string |
|
twine-username |
User name used when uploading to the public Test PyPI index. |
False |
string |
__token__ |
twine-token |
Password used when uploading to the public Test PyPI index. |
False |
string |
|
use-trusted-publisher |
Whether to use the OIDC token for releasing. Default value is Note
|
False |
boolean |
False |
dry-run |
Whether to run or not this action in testing mode. Testing mode executes
all the action steps except the releasing artifacts one. This allows
developers to verify the health of the action once integrated in their
CI/CD pipelines without actually publishing artifacts. Default value is
|
False |
boolean |
False |
python-version |
Python version for installing and using twine. |
False |
string |
3.10 |
skip-existing |
Continue uploading files if one already exists. Only valid when uploading to PyPI. Other implementations may not support this. |
False |
boolean |
True |
Examples#
Release to test PyPI
release-pypi-test:
name: "Release to test PyPI"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the test PyPI repository"
uses: ansys/actions/release-pypi-test@v8.1
with:
library-name: "ansys-<product>-<library>"
twine-username: "__token__"
twine-token: ${{ secrets.PYANSYS_PYPI_TEST_PAT }}
Release PyPI public action#
Release library artifacts to the PyPI public index. Use the PYPI_TOKEN
as
the token. Artifacts get downloaded from the CI/CD pipeline and are assumed to be
named <library-name>-artifacts
. This file is expected to contain a wheel file
and a source distribution file for the desired library.
Input |
Description |
Required |
Type |
Default |
---|---|---|---|---|
library-name |
Name of the Python library to be published. |
True |
string |
|
twine-username |
User name used when uploading to the public PyPI index. |
False |
string |
__token__ |
twine-token |
Password used when uploading to the public PyPI index. |
False |
string |
|
use-trusted-publisher |
Whether to use the OIDC token for releasing. Default value is Note
|
False |
boolean |
False |
dry-run |
Whether to run or not this action in testing mode. Testing mode executes
all the action steps except the releasing artifacts one. This allows
developers to verify the health of the action once integrated in their
CI/CD pipelines without actually publishing artifacts. Default value is
|
False |
boolean |
False |
skip-existing |
Continue uploading files if one already exists. Only valid when uploading to PyPI. Other implementations may not support this. |
False |
boolean |
True |
python-version |
Python version for installing and using twine. |
False |
string |
3.10 |
Examples#
Release to public PyPI using Trusted Publisher
release-pypi-public:
name: "Release to public PyPI using Trusted Publisher"
runs-on: ubuntu-latest
needs: [build-library]
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
# IMPORTANT: We typically combine this action with ansys/actions/release-github
# to create a release on GitHub, which requires the following permission
contents: write
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the public PyPI repository using Trusted Publisher"
uses: ansys/actions/release-pypi-public@v8.1
with:
library-name: "ansys-<product>-<library>"
use-trusted-publisher: true
Release to public PyPI
release-pypi-public:
name: "Release to public PyPI"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the public PyPI repository"
uses: ansys/actions/release-pypi-public@v8.1
with:
library-name: "ansys-<product>-<library>"
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
Release GitHub action#
Release library artifacts to the GitHub release section. Some minimum
artifacts are required before running this action. These artifacts include
documentation-html
, documentation-pdf
, and
<library-name>-artifacts
files. This last file must contain the wheels and
source distribution files of the library.
Input |
Description |
Required |
Type |
Default |
---|---|---|---|---|
library-name |
Name of the Python library to be published. |
True |
string |
|
additional-artifacts |
String containing a list of additional artifacts to be included in the GitHub release. |
False |
string |
|
dry-run |
Whether to run or not this action in testing mode. Testing mode executes
all the action steps except the releasing artifacts one. This allows
developers to verify the health of the action once integrated in their
CI/CD pipelines without actually publishing artifacts. Default value is
|
False |
boolean |
False |
only-code |
Only include the source code in the release. This can be helpful for repositories that don’t create wheels and/or documentation. |
False |
boolean |
False |
Examples#
Release to GitHub
release-gitub:
name: "Release to GitHub"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to GitHub"
uses: ansys/actions/release-github@v8.1
with:
library-name: "ansys-<product>-<library>"