Skip to content

Commit 2ef2dd4

Browse files
timtreisclaude
andcommitted
Switch release workflow to PyPI trusted publishing
- Replace secret-based PyPI token with OIDC trusted publishing - Use uv for building instead of pip/hatch dual build - Split into build + publish jobs with artifact handoff - Add pypi environment for deployment protection - Update actions to v5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3135e1d commit 2ef2dd4

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

.github/workflows/release.yaml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,43 @@ on:
44
release:
55
types: [published]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
711
jobs:
8-
package_and_release:
12+
build:
913
runs-on: ubuntu-latest
10-
if: startsWith(github.ref, 'refs/tags/v')
1114
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python 3.12
14-
uses: actions/setup-python@v5
15+
- uses: actions/checkout@v5
1516
with:
16-
python-version: "3.12"
17-
cache: pip
18-
- name: Install build dependencies
19-
run: python -m pip install --upgrade pip wheel twine build
17+
filter: blob:none
18+
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
2021
- name: Build package
21-
run: python -m build
22+
run: uv build
2223
- name: Check package
23-
run: twine check --strict dist/*.whl
24-
- name: Install hatch
25-
run: pip install hatch
26-
- name: Build project for distribution
27-
run: hatch build
28-
- name: Publish a Python distribution to PyPI
29-
uses: pypa/gh-action-pypi-publish@release/v1
24+
run: uvx twine check --strict dist/*
25+
- name: Upload build artifacts
26+
uses: actions/upload-artifact@v4
3027
with:
31-
password: ${{ secrets.PYPI_API_TOKEN }}
28+
name: dist
29+
path: dist/
30+
31+
publish:
32+
needs: build
33+
runs-on: ubuntu-latest
34+
permissions:
35+
id-token: write # for PyPI trusted publishing
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/spatialdata-plot
39+
steps:
40+
- name: Download build artifacts
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: dist
44+
path: dist/
45+
- name: Publish to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)