Skip to content

Commit

Permalink
Configure PyPI trusted publishing (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannick-roeder authored Jan 15, 2025
1 parent 7f18e59 commit 0e9aa8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- ubuntu-24.04
- windows-2022
python-version: ["3.11", "3.12"]
is-draft-pr:
is-draft-pr:
- ${{ github.event.pull_request.draft }}
include:
- python-version: "3.11"
Expand All @@ -51,7 +51,7 @@ jobs:

- name: Lint (ruff)
run: |
uv run --frozen ruff check . --config pyproject.toml --no-fix ${{ matrix.format-for-github && '--output-format=github' }}
uv run --frozen ruff check . --config pyproject.toml --no-fix ${{ matrix.format-for-github && '--output-format=github' }}
- name: Typing (pyright)
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- ubuntu-24.04
- windows-2022
python-version: ["3.11", "3.12"]
is-draft-pr:
is-draft-pr:
- ${{ github.event.pull_request.draft }}
exclude:
# skip Windows jobs on draft PRs because they are slow
Expand Down Expand Up @@ -144,6 +144,8 @@ jobs:
name: Publish snapshot to TestPyPI
needs: [lint, format, test, docs]
runs-on: ubuntu-24.04
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -168,7 +170,7 @@ jobs:
- name: Restore clean Git working directory
# clean Git working directory is needed for the next bumpversion call
# we only need the version result from the first `patch` bump which is stored as a step output
run: git restore .
run: git restore .

- name: Bump version snapshot time
uses: bakdata/ci-templates/actions/bump-version@1.50.4
Expand All @@ -183,7 +185,6 @@ jobs:
run: uv publish
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}

publish-docs-from-main:
name: Publish docs (main)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-24.04
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -22,5 +24,3 @@ jobs:

- name: Publish
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ docs = [

[tool.uv]
package = true
trusted-publishing = "always"

[build-system]
requires = ["hatchling"]
Expand Down

0 comments on commit 0e9aa8f

Please sign in to comment.