You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/python-publish.yml
+51-35Lines changed: 51 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,6 @@
1
-
# This workflow will upload a Python Package to PyPI when a release is created
2
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
-
4
-
# This workflow uses actions that are not certified by GitHub.
5
-
# They are provided by a third-party and are governed by
6
-
# separate terms of service, privacy policy, and support
7
-
# documentation.
1
+
# Builds platform wheels for Linux (manylinux), Windows, and macOS, then
2
+
# publishes everything to PyPI via OIDC Trusted Publishing (no API token).
3
+
# Triggered when a GitHub Release is published.
8
4
9
5
name: Upload Python Package
10
6
@@ -16,7 +12,39 @@ permissions:
16
12
contents: read
17
13
18
14
jobs:
19
-
release-build:
15
+
# ── Build binary wheels (one runner per platform) ───────────────────────────
16
+
build-wheels:
17
+
name: Build wheels on ${{ matrix.os }}
18
+
runs-on: ${{ matrix.os }}
19
+
strategy:
20
+
matrix:
21
+
os: [ubuntu-latest, windows-latest, macos-latest]
22
+
23
+
steps:
24
+
- uses: actions/checkout@v4
25
+
26
+
- name: Build wheels
27
+
uses: pypa/cibuildwheel@v2.22.0
28
+
env:
29
+
# CPython 3.8 – 3.14 only; skip PyPy (not tested with this extension)
# Skip musl/Alpine — system zlib may not be present in all musl images
32
+
CIBW_SKIP: "*-musllinux_*"
33
+
# macOS: build both Intel and Apple-Silicon wheels
34
+
CIBW_ARCHS_MACOS: x86_64 arm64
35
+
# Linux: x86_64 only (add aarch64 later via QEMU if needed)
36
+
CIBW_ARCHS_LINUX: x86_64
37
+
# Windows: 64-bit only
38
+
CIBW_ARCHS_WINDOWS: AMD64
39
+
40
+
- uses: actions/upload-artifact@v4
41
+
with:
42
+
name: cibw-wheels-${{ matrix.os }}
43
+
path: ./wheelhouse/*.whl
44
+
45
+
# ── Build source distribution ────────────────────────────────────────────────
46
+
build-sdist:
47
+
name: Build source distribution
20
48
runs-on: ubuntu-latest
21
49
22
50
steps:
@@ -25,50 +53,38 @@ jobs:
25
53
- uses: actions/setup-python@v5
26
54
with:
27
55
python-version: "3.x"
28
-
29
-
- name: Install Dependencies
30
-
run: |
31
-
python -m pip install pybind11
32
56
33
-
- name: Build release distributions
57
+
- name: Build sdist
34
58
run: |
35
-
# NOTE: put your own distribution build steps here.
36
59
python -m pip install build
37
-
python -m build
60
+
python -m build --sdist
38
61
39
-
- name: Upload distributions
40
-
uses: actions/upload-artifact@v4
62
+
- uses: actions/upload-artifact@v4
41
63
with:
42
-
name: release-dists
43
-
path: dist/
64
+
name: cibw-sdist
65
+
path: dist/*.tar.gz
44
66
67
+
# ── Publish to PyPI via OIDC Trusted Publishing ──────────────────────────────
45
68
pypi-publish:
69
+
name: Publish to PyPI
46
70
runs-on: ubuntu-latest
47
-
needs:
48
-
- release-build
71
+
needs:[build-wheels, build-sdist]
72
+
49
73
permissions:
50
-
#IMPORTANT: this permission is mandatory for trusted publishing
74
+
#Required for OIDC Trusted Publishing — no API token needed
51
75
id-token: write
52
76
53
-
# Dedicated environments with protections for publishing are strongly recommended.
54
-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
55
77
environment:
56
78
name: pypi
57
-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
58
79
url: https://pypi.org/p/docx-comment-parser
59
-
#
60
-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
61
-
# ALTERNATIVE: exactly, uncomment the following line instead:
0 commit comments