Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure PyPI trusted publishing #592

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
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
Loading