Skip to content

Commit 0119dfb

Browse files
committed
feat: add PyPI trusted publishing
1 parent 561d334 commit 0119dfb

3 files changed

Lines changed: 10 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1919

2020
steps:
2121
- name: Checkout repository
@@ -36,7 +36,7 @@ jobs:
3636
API_KEY: ${{ secrets.API_KEY }}
3737

3838
- name: Run example tests
39-
if: matrix.python-version == '3.13'
39+
if: matrix.python-version == '3.14'
4040
run: pytest -k "example"
4141
env:
4242
API_KEY: ${{ secrets.API_KEY }}

.github/workflows/release.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1818
steps:
1919
- uses: actions/checkout@v6
2020

@@ -31,7 +31,7 @@ jobs:
3131
API_KEY: ${{ secrets.API_KEY }}
3232

3333
- name: Run example tests
34-
if: matrix.python-version == '3.13'
34+
if: matrix.python-version == '3.14'
3535
run: pytest -k "example"
3636
env:
3737
API_KEY: ${{ secrets.API_KEY }}
@@ -62,19 +62,18 @@ jobs:
6262
name: Publish release
6363
needs: [build]
6464
runs-on: ubuntu-latest
65+
environment:
66+
name: pypi
67+
url: https://pypi.org/p/serpapi
6568
permissions:
6669
contents: write
67-
packages: write
70+
id-token: write
6871
steps:
6972
- uses: actions/download-artifact@v8
7073
with:
7174
name: dist
7275
path: dist/
7376

74-
- uses: actions/setup-python@v6
75-
with:
76-
python-version: "3.13"
77-
7877
- name: Create GitHub Release
7978
env:
8079
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -83,14 +82,8 @@ jobs:
8382
gh release create ${{ github.ref_name }} dist/* --generate-notes \
8483
|| gh release upload ${{ github.ref_name }} dist/* --clobber
8584
86-
- name: Install twine
87-
run: pip install --upgrade pip twine
88-
8985
- name: Publish to PyPI
90-
env:
91-
TWINE_USERNAME: __token__
92-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
93-
run: twine upload dist/*
86+
uses: pypa/gh-action-pypi-publish@release/v1
9487

9588
smoke-test:
9689
name: Smoke test published package

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,4 @@ Bug reports and pull requests are welcome on GitHub. Once dependencies are insta
380380
```
381381
This triggers the [release workflow](.github/workflows/release.yml), which tests, builds, and publishes to PyPI, then smoke-tests the published package.
382382

383-
> **Required secrets:** `PYPI_API_TOKEN` (PyPI upload token) and `API_KEY` (used in smoke-test live search).
383+
> **Required secret:** `API_KEY` (used in smoke-test live search).

0 commit comments

Comments
 (0)