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.

Attention

Starting with version ansys-actions@v9, the use-trusted-publisher input parameter is deprecated. Refer to the Release to PyPI as a trusted publishers if you wish to use this security feature.

Source code for this action

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 false. This is useful when you want to publish to PyPI through a CI/CD pipeline as a Trusted Publisher. It is necessary that your repository has been authorized to use Trusted Publisher’s. For more information, see Using a Trusted Publisher.

Note

permissions: id-token: write is mandatory for trusted publishing.

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.

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.11

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.2
      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.

Attention

Starting with version ansys-actions@v9, the use-trusted-publisher input parameter is deprecated. Refer to the Release to PyPI as a trusted publishers if you wish to use this security feature.

Source code for this action

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 false. This is useful when you want to publish to PyPI through a CI/CD pipeline as a Trusted Publisher. It is necessary that your repository has been authorized to use Trusted Publisher’s. For more information, see Using a Trusted Publisher.

Note

permissions: id-token: write is mandatory for trusted publishing.

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.

False

boolean

False

python-version

Python version for installing and using twine.

False

string

3.11

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.2
      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.

Attention

Starting with version ansys-actions@v9, the use-trusted-publisher input parameter is deprecated. Refer to the Release to PyPI as a trusted publishers if you wish to use this security feature.

Source code for this action

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 false. This is useful when you want to publish to PyPI through a CI/CD pipeline as a Trusted Publisher. It is necessary that your repository has been authorized to use Trusted Publisher’s. For more information, see Using a Trusted Publisher.

Note

permissions: id-token: write is mandatory for trusted publishing.

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.

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.11

Examples#

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.2
      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.

If you are using the title_format and issue_format from the doc-changelog action setup guide, https://actions.docs.ansys.com/version/dev/migrations/docs-changelog-setup.html, the changelog for your release is included in the release notes on GitHub.

Source code for this action

Input

Description

Required

Type

Default

library-name

Name of the Python library to be published.

True

string

token

Required password, key or token with the correct credentials for deploying the documentation. If deploying to the current repository, the secrets.GITHUB_TOKEN token is is enough. For workflows deploying to other repositories, generate and use a token with writing access to that repository.

True

string

python-version

Python version used for installing towncrier and retrieving the release notes.

False

string

3.12

use-python-cache

Whether to use the Python cache for installing previously downloaded libraries. If true, previously downloaded libraries are installed from the Python cache. If false, libraries are downloaded from the PyPI index.

False

boolean

True

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.

False

boolean

False

toml-version

Toml version used for retrieving the towncrier directory.

False

string

0.10.2

pypandoc-binary-version

Pypandoc-binary version used for converting rst text to markdown.

False

string

1.15

changelog-release-notes

Whether or not to generate release notes using the changelog file from the pyproject.toml file’s [tool.towncrier] section.

False

boolean

True

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

add-artifact-attestation-notes

Whether or not to add artifact attestation notes to the release notes.

False

boolean

False

generate_release_notes

Whether to automatically generate the name and body for this release.

Warning

If this option is activated and the action is used to create text content for the release notes body, the content will be pre-pended to the automatically generated notes.

False

boolean

False

Examples#

Release to GitHub
release-github:
  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.2
      with:
        library-name: "ansys-<product>-<library>"