forked from refnx/refnx
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (134 loc) · 4.03 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# This action releases refnx on PyPI for every version tagged commit (e.g. v0.0.1)
name: PyPI/Github Release
on:
push:
tags:
- "v*"
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy:
matrix:
os: [windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
- name: build wheels
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_TEST_COMMAND: pytest --pyargs refnx.reflect.test.test_reflect
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET="10.13"
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_linux_x86_64_wheels:
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_TEST_COMMAND: pytest --pyargs refnx.reflect.test.test_reflect
CIBW_BUILD: "*-manylinux_x86_64"
- uses: actions/upload-artifact@v4
with:
name: wheels-manylinux
path: ./wheelhouse/*.whl
build_linux_musl_wheels:
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_TEST_COMMAND: pytest --pyargs refnx.reflect.test.test_reflect
CIBW_BUILD: "*-musllinux_x86_64"
- uses: actions/upload-artifact@v4
with:
name: wheels-musllinux
path: ./wheelhouse/*.whl
make_sdist:
name: Make sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist/*.tar.gz
check-version:
runs-on: ubuntu-latest
needs: [build_linux_musl_wheels, build_linux_x86_64_wheels, build_wheels, make_sdist]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Check version
run: |
python -m pip install numpy scipy orsopy
ls dist
python -m pip install --only-binary=refnx --no-index --find-links=dist refnx
cd dist
RNX_VERSION="$(python -c "import refnx;print(refnx.version.release)")"
cd ..
if [ $RNX_VERSION == "True" ]; then
echo "It's a release version of refnx"
else
echo "This is not a release version of refnx"
exit 1
fi
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: [check-version]
environment:
name: pypi
url: https://pypi.org/p/refnx
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# repository-url: https://test.pypi.org/legacy/
skip_existing: true
release-github:
runs-on: ubuntu-latest
needs: [ pypi-publish ]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- uses: ncipollo/release-action@v1
with:
artifacts: "dist/refnx*.tar.gz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true