Skip to content

Commit 270ba78

Browse files
committed
Build wheels at merge time, but publish them upon release
Signed-off-by: pdmurray <[email protected]>
1 parent 1523ba1 commit 270ba78

File tree

2 files changed

+63
-64
lines changed

2 files changed

+63
-64
lines changed

.github/workflows/pypi_release.yml

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,26 @@
1-
name: Build and Release Python Bindings to PyPI
1+
name: Release Python Bindings to PyPI
22

33
on:
44
release:
55
types: [published]
66
workflow_dispatch:
77
inputs:
8-
tag:
9-
type: string
10-
default: ''
11-
required: false
12-
description: Ref to build
138
test_pypi:
149
type: boolean
1510
description: 'Test release: publish on test.pypi.org'
1611
default: false
1712

18-
jobs:
19-
build-sdist:
20-
name: Build sdist
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name:  Checkout the repo
24-
uses: actions/checkout@v3
25-
with:
26-
ref: ${{ github.event.inputs.tag }}
27-
28-
- name: 🐍 Set up Python
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: '3.11'
32-
33-
- name:  Install build dependencies
34-
run: |
35-
python -m pip install build
36-
37-
- name: 📦 Build the sdist
38-
working-directory: ./openvdb/openvdb/python
39-
run: |
40-
python -m build --sdist
41-
42-
- name:  Upload artifact
43-
uses: actions/upload-artifact@v3
44-
with:
45-
name: dist
46-
path: ./openvdb/openvdb/python/dist/
47-
48-
build-wheels:
49-
runs-on: ${{ matrix.os }}
50-
strategy:
51-
matrix:
52-
os: [ubuntu-latest, windows-latest, macos-latest]
53-
steps:
54-
- name:  Checkout the repo
55-
uses: actions/checkout@v3
56-
with:
57-
ref: ${{ github.event.inputs.tag }}
58-
59-
60-
- name: Build wheels
61-
uses: pypa/[email protected]
62-
with:
63-
package-dir: ./openvdb/openvdb/python
64-
config-file: ./openvdb/openvdb/python/pyproject.toml
65-
env:
66-
CIBW_ARCHS_MACOS: auto universal2
67-
68-
- name:  Upload artifact
69-
uses: actions/upload-artifact@v3
70-
with:
71-
name: dist
72-
path: ./openvdb/openvdb/python/dist/
73-
7413
publish:
7514
name: Publish Python packages on PyPI
7615
needs: [build-sdist, build-wheels]
7716
runs-on: ubuntu-latest
7817
steps:
79-
- name:  Download artifacts
80-
uses: actions/download-artifact@v3
18+
- name:  Download artifacts from commit ${{ github.sha }}
19+
uses: dawidd6/action-download-artifact@v2
8120
with:
21+
workflow: wheels.yml
22+
workflow_conclustion: success
23+
commit: ${{ github.sha }}
8224
name: dist
8325
path: dist
8426

.github/workflows/wheels.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build Python Bindings
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
8+
jobs:
9+
build-sdist:
10+
name: Build sdist
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name:  Checkout the repo
14+
uses: actions/checkout@v3
15+
16+
- name: 🐍 Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name:  Install build dependencies
22+
run: |
23+
python -m pip install build
24+
25+
- name: 📦 Build the sdist
26+
working-directory: ./openvdb/openvdb/python
27+
run: |
28+
python -m build --sdist
29+
30+
- name:  Upload artifact
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: dist
34+
path: ./openvdb/openvdb/python/dist/
35+
36+
build-wheels:
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: [ubuntu-latest, windows-latest, macos-latest]
41+
steps:
42+
- name:  Checkout the repo
43+
uses: actions/checkout@v3
44+
45+
- name: 🛞 Build wheels
46+
uses: pypa/[email protected]
47+
with:
48+
package-dir: ./openvdb/openvdb/python
49+
config-file: ./openvdb/openvdb/python/pyproject.toml
50+
env:
51+
CIBW_ARCHS_MACOS: auto universal2
52+
53+
- name:  Upload artifact
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: dist
57+
path: ./openvdb/openvdb/python/dist/

0 commit comments

Comments
 (0)