Skip to content

Commit

Permalink
CI/CD: Rework the publishing GH actions
Browse files Browse the repository at this point in the history
* Use now trusted publishing instead of API tokens for authentication
  • Loading branch information
bnjmnp committed Dec 9, 2024
1 parent a910fcf commit 171d940
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pysoem
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/download-artifact@v4
Expand All @@ -54,7 +59,4 @@ jobs:
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PYSOEM_ACCESS_TOKEN }}
repository-url: https://test.pypi.org/legacy/
12 changes: 7 additions & 5 deletions .github/workflows/release_triggerd_build_and_upload_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

name: Build PySOEM sdist and wheels and upload them to PyPI

# This is triggerd upon creating a release on GitHub.
# This is triggered upon creating a release on GitHub.
on:
release:
types: [published]
Expand Down Expand Up @@ -46,6 +46,11 @@ jobs:
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pysoem
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/download-artifact@v4
Expand All @@ -55,7 +60,4 @@ jobs:
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYSOEM_ACCESS_TOKEN }}
- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 171d940

Please sign in to comment.