Skip to content

Commit

Permalink
Do not rely on trusted publishing for PyPI upload (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger authored Dec 16, 2024
1 parent 370430c commit 74f3123
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/_pypi_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ name: PyPI Publish

on:
workflow_call:
secrets:
API_TOKEN:
required: true

permissions: read-all

Expand All @@ -35,4 +38,5 @@ jobs:
- name: Publish package distributions to PyPI (optional - testpypi)
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.API_TOKEN }}
repository-url: https://upload.pypi.org/legacy/
4 changes: 4 additions & 0 deletions .github/workflows/_pypi_test_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ name: PyPI Publish

on:
workflow_call:
secrets:
API_TOKEN:
required: true

permissions: read-all

Expand All @@ -32,4 +35,5 @@ jobs:
- name: Publish package distributions to PyPI (optional - testpypi)
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
6 changes: 5 additions & 1 deletion .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
types: [created]

concurrency:
group: CICD-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -101,6 +101,8 @@ jobs:
- CodeQL
name: Upload current version to Test PyPI
uses: ./.github/workflows/_pypi_test_publish.yaml
secrets:
API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}

## Upload the python-kraken-sdk to Production PyPI
##
Expand All @@ -116,3 +118,5 @@ jobs:
- CodeQL
name: Upload the current release to PyPI
uses: ./.github/workflows/_pypi_publish.yaml
secrets:
API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 74f3123

Please sign in to comment.