Skip to content

Commit 96a15fa

Browse files
chore: Push releases to public PyPI (#11)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 8b27817 commit 96a15fa

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

‎.github/workflows/build_and_package.yml‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
env:
1515
MAIN_PYTHON_VERSION: "3.11"
1616
POETRY_VERSION: "2.3.2"
17+
PACKAGE_NAME: "VISOR"
1718

1819
# For Solutions private PyPI:
1920
POETRY_HTTP_BASIC_SOLUTIONS_PRIVATE_PYPI_USERNAME: "PAT"
@@ -77,6 +78,10 @@ jobs:
7778
(needs.update-changelog.result == 'success' || needs.update-changelog.result == 'skipped') &&
7879
(github.event_name != 'schedule' || github.ref == 'refs/heads/main')
7980
runs-on: ubuntu-latest
81+
permissions:
82+
id-token: write # Required for PyPI trusted publisher authentication (OIDC)
83+
attestations: write # Required by pypa/gh-action-pypi-publish (>=v1.11)
84+
contents: write # Needed to download release artifacts
8085
steps:
8186
- name: Checkout repository
8287
uses: actions/checkout@v4
@@ -266,24 +271,24 @@ jobs:
266271
path: dist/*.whl
267272

268273
- name: Release to Azure Solutions PyPI
269-
if : (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
274+
if: |
275+
(github.event_name == 'schedule' && github.ref == 'refs/heads/main') ||
276+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
270277
uses: ansys-internal/solution-applications-actions/release-to-private-pypi@v18
271278
with:
272279
python-version: ${{ env.MAIN_PYTHON_VERSION }}
273280
twine-repository-url: https://pkgs.dev.azure.com/ansys-solutions/_packaging/ansys-solutions/pypi/upload/
274281
twine-username: "TOKEN"
275282
twine-password: ${{ secrets.SOLUTIONS_PRIVATE_PYPI_UPLOAD_TOKEN }}
276283

277-
- name: Release to Azure PyAnsys PyPI
278-
if: |
279-
(github.event_name == 'schedule' && github.ref == 'refs/heads/main') ||
280-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
281-
uses: ansys-internal/solution-applications-actions/release-to-private-pypi@v18
284+
- name: "Upload artifacts to PyPI"
285+
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
286+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
282287
with:
283-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
284-
twine-repository-url: https://pkgs.dev.azure.com/pyansys/_packaging/ansys-solutions/pypi/upload/
285-
twine-username: "TOKEN"
286-
twine-password: ${{ secrets.SOLUTIONS_PRIVATE_PYPI_ADMIN_TOKEN }}
288+
repository-url: "https://upload.pypi.org/legacy/"
289+
print-hash: true
290+
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
291+
skip-existing: false
287292

288293
outputs:
289294
package_version: ${{ steps.set_package_version.outputs.package_version }}

‎doc/changelog.d/11.maintenance.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Push releases to public PyPI

0 commit comments

Comments
 (0)