Skip to content

Commit b020efb

Browse files
committed
add a build and publish workflow
1 parent 7ba33f9 commit b020efb

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# based off the cookiecutter action provided by https://github.com/scientific-python/cookie
2+
name: wheels
3+
4+
on:
5+
workflow_dispatch:
6+
release:
7+
types:
8+
- created
9+
- published
10+
pull_request:
11+
paths:
12+
- .github/workflows/build_and_publish.yml
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
env:
19+
# Many color libraries just need this to be set to any value, but at least
20+
# one distinguishes color depth, where "3" -> "256-bit color".
21+
FORCE_COLOR: 3
22+
23+
jobs:
24+
make_sdist:
25+
name: Make SDist
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Build SDist
33+
run: pipx run build --sdist
34+
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
name: cibw-sdist
38+
path: dist/*.tar.gz
39+
40+
build_wheels:
41+
name: Wheel on ${{ matrix.os }}
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
53+
- uses: pypa/[email protected]
54+
55+
- name: Upload wheels
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
59+
path: wheelhouse/*.whl
60+
61+
upload_all:
62+
needs: [build_wheels, make_sdist]
63+
environment: pypi
64+
permissions:
65+
id-token: write
66+
attestations: write
67+
contents: read
68+
runs-on: ubuntu-latest
69+
if: github.event_name == 'release' && github.event.action == 'published'
70+
71+
steps:
72+
- uses: actions/download-artifact@v4
73+
with:
74+
pattern: cibw-*
75+
path: dist
76+
merge-multiple: true
77+
78+
- name: Generate artifact attestations
79+
uses: actions/[email protected]
80+
with:
81+
subject-path: "dist/*"
82+
83+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)