-
Notifications
You must be signed in to change notification settings - Fork 77
135 lines (115 loc) · 3.34 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
paths:
- .github/workflows/release.yml
env:
# Latest Jupyter requires this to acknowledge deprecation
JUPYTER_PLATFORM_DIRS: 1
jobs:
release_check:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- if: ${{ github.ref == 'refs/heads/main' }}
run: |
pip install packaging
python .ci/release_check.py
- id: tag
run: echo "tag=$(python version.py)" >> $GITHUB_OUTPUT
wheels:
needs: release_check
name: ${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
arch: [auto, aarch64]
py: [cp39, cp310, cp311, cp312, cp313]
exclude:
- os: windows-latest
arch: aarch64
- os: macos-13
arch: aarch64
- os: macos-14
arch: aarch64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v3
- uses: yezz123/setup-uv@v4
- uses: pypa/cibuildwheel@v2.21
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.py }}-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
sdist:
needs: release_check
name: source package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: pipx run build --sdist
- run: python -m pip install --upgrade pip setuptools
- run: python -m pip install -v $(echo dist/iminuit-*)[test]
- run: python -m pytest
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
upload:
needs: [wheels, sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/iminuit/
permissions:
id-token: write
attestations: write
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: "*"
merge-multiple: true
path: dist
- name: Generate artifact attestation for sdist and wheels
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2
with:
subject-path: "dist/iminuit-*"
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{secrets.pypi_password}}
release:
needs: [release_check, upload]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
name: v${{ needs.release_check.outputs.tag }}
tag_name: v${{ needs.release_check.outputs.tag }}
target_commitish: ${{ github.ref_name }}
generate_release_notes: true