Skip to content

Commit 15d1764

Browse files
committed
chore(ci): Add GitHub workflow for build and publish
1 parent 5f9a2eb commit 15d1764

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

.github/workflows/wheels.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Build wheels
2+
3+
on:
4+
push:
5+
branches: [main, dev, wheel]
6+
tags: ['*']
7+
pull_request:
8+
branches: [main, dev]
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
MACOSX_DEPLOYMENT_TARGET: '10.12'
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
build_sdist:
24+
name: Build & verify package
25+
runs-on: ubuntu-latest
26+
permissions:
27+
attestations: write
28+
id-token: write
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- uses: hynek/build-and-inspect-python-package@v2
34+
with:
35+
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }}
36+
skip-wheel: true
37+
38+
build_wheels:
39+
name: Build wheels on ${{ matrix.os }}
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
matrix:
43+
os:
44+
- ubuntu-latest
45+
- ubuntu-24.04-arm
46+
- windows-latest
47+
- macos-13
48+
- macos-latest
49+
fail-fast: false
50+
permissions:
51+
attestations: write
52+
id-token: write
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Build wheels
60+
uses: pypa/[email protected]
61+
62+
- name: Generate artifact attestation for wheels
63+
if: ${{ github.event_name != 'pull_request' }}
64+
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
65+
with:
66+
subject-path: "wheelhouse/bids_validator_deno-*.whl"
67+
68+
- uses: actions/upload-artifact@v4
69+
with:
70+
name: wheel-${{ matrix.os }}
71+
path: ./wheelhouse
72+
73+
test-publish:
74+
name: Push package to test.pypi.org
75+
# if: github.event_name == 'push'
76+
runs-on: ubuntu-latest
77+
needs: [build_sdist, build_wheels]
78+
# permissions:
79+
# id-token: write
80+
81+
steps:
82+
- name: Download sdist
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: Packages
86+
path: dist
87+
88+
- name: Download wheels
89+
uses: actions/download-artifact@v4
90+
with:
91+
pattern: wheel-*
92+
path: dist
93+
94+
- run: |
95+
mv dist/*/* dist/
96+
rmdir dist/*/
97+
98+
# - name: Upload package to PyPI
99+
# uses: pypa/gh-action-pypi-publish@release/v1
100+
# with:
101+
# repository-url: https://test.pypi.org/legacy/
102+
# skip-existing: true
103+
104+
publish:
105+
name: Publish released package to pypi.org
106+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
107+
runs-on: ubuntu-latest
108+
needs: [build_sdist, build_wheels]
109+
permissions:
110+
id-token: write
111+
112+
steps:
113+
- name: Download sdist
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: Packages
117+
path: dist
118+
119+
- name: Download wheels
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: wheel-*
123+
path: dist
124+
125+
- run: |
126+
mv dist/*/* dist/
127+
rmdir dist/*/
128+
129+
- name: Upload package to PyPI
130+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)