Skip to content

Commit a22cd99

Browse files
committed
Split wheel upload and PyPI publish into separate optimized jobs so all matrix runners build wheels and a unified Linux job publishes them to PyPI
1 parent 1e22937 commit a22cd99

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,11 @@ jobs:
7272
shell: bash -l {0}
7373
run: bazel run //:build_pip_package
7474

75-
- name: Publish Package to PyPI
76-
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/r'))
77-
uses: pypa/gh-action-pypi-publish@release/v1
75+
- name: Upload Wheel Artifact
76+
uses: actions/upload-artifact@v4
7877
with:
79-
password: ${{ secrets.PYPI_API_TOKEN }}
80-
packages-dir: dist/
81-
skip-existing: true
78+
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
79+
path: dist/*.whl
8280

8381
docker-serving-build:
8482
name: Build Docker Serving Image
@@ -94,3 +92,23 @@ jobs:
9492
run: |
9593
cd struct2tensor/tools/tf_serving_docker
9694
docker build -t struct2tensor-serving:latest .
95+
96+
pypi-publish:
97+
name: Publish Wheels to PyPI
98+
needs: build
99+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/r'))
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Download all wheels
103+
uses: actions/download-artifact@v4
104+
with:
105+
pattern: wheels-*
106+
path: dist/
107+
merge-multiple: true
108+
109+
- name: Publish Package to PyPI
110+
uses: pypa/gh-action-pypi-publish@release/v1
111+
with:
112+
password: ${{ secrets.PYPI_API_TOKEN }}
113+
packages-dir: dist/
114+
skip-existing: true

0 commit comments

Comments
 (0)