Skip to content

Commit b021796

Browse files
ci: add trusted publishers for release (#875)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 3ed7dee commit b021796

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/ci_cd_release.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,22 @@ jobs:
168168
needs: [changelog-deployment, build-library]
169169
runs-on: ubuntu-latest
170170
permissions:
171+
id-token: write
171172
contents: write
172173
steps:
173-
- name: "Release to the public PyPI repository"
174-
uses: ansys/actions/release-pypi-public@1096998b81f7ebdea116b683e11f3a8bda759ca6 # v9.0.15
174+
- name: "Download the library artifacts from build-library step"
175+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
175176
with:
176-
library-name: ${{ env.PACKAGE_NAME }}
177-
twine-username: "__token__"
178-
twine-token: ${{ secrets.PYPI_TOKEN }}
177+
name: ${{ env.PACKAGE_NAME }}-artifacts
178+
path: ${{ env.PACKAGE_NAME }}-artifacts
179+
180+
- name: "Upload artifacts to PyPI using trusted publisher"
181+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
182+
with:
183+
repository-url: "https://upload.pypi.org/legacy/"
184+
print-hash: true
185+
packages-dir: ${{ env.PACKAGE_NAME }}-artifacts
186+
skip-existing: false
179187

180188
- name: "Release to GitHub"
181189
uses: ansys/actions/release-github@1096998b81f7ebdea116b683e11f3a8bda759ca6 # v9.0.15

doc/changelog/875.maintenance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add trusted publishers for release

0 commit comments

Comments
 (0)