-
Notifications
You must be signed in to change notification settings - Fork 3
224 lines (192 loc) Β· 7.64 KB
/
publish-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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: Publish
on:
push:
tags:
- v*.*.*
workflow_dispatch:
permissions:
contents: read
jobs:
make_sdist:
name: Make source distribution π package π¦
runs-on: ubuntu-latest
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Setup | Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
- name: Action | Build SDist
run: pipx run build --sdist
- name: Action | Upload Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: dist-cibw-sdist
path: dist/*.tar.gz
build_wheels:
name: Build Python π wheel π¦ for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Setup | Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Action | Build Wheels
uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.0
- name: Action | Upload Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: dist-cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_win_exe:
name: Build standalone executable βοΈ for Windows π₯οΈ
runs-on: [windows-latest]
continue-on-error: true
steps:
- name: Setup | Install python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.12'
- name: Setup | Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup | Install Dependencies
run: pip install -r requirements.txt -r requirements-exe.txt
- run: pip install .
- run: python setup.py build_ext -i
- name: Setup | Get the sansmic version number
id: vars
run: |
python -c "import sansmic; print('sansmic_version='+sansmic.__version__)" >> $Env:GITHUB_ENV
echo "sha_short=$(git rev-parse --short HEAD)" >> $Env:GITHUB_ENV
- name: Action | Run PyInstaller
run: |
pyinstaller --collect-all sansmic --collect-all click --hidden-import sansmic --hidden-import click --hidden-import pandas --hidden-import pybind11 --hidden-import numpy --hidden-import h5py --hidden-import pyyaml --hidden-import lasio -n sansmic --add-binary src/python/sansmic/libsansmic.cp312-win_amd64.pyd:sansmic src/python/sansmic/app.py
- name: Action | Create examples
run: mkdir dist/sansmic/examples
- run: copy README.md dist/sansmic/README.md
- run: copy LICENSE dist/sansmic/LICENSE.md
- run: copy CHANGELOG.md dist/sansmic/CHANGELOG.md
- run: copy AUTHORS.md dist/sansmic/AUTHORS.md
- run: copy SECURITY.md dist/sansmic/SECURITY.md
- run: sansmic-convert tests/baseline.dat dist/sansmic/examples/baseline.toml
- run: Compress-Archive -Path dist/sansmic -DestinationPath dist/sansmic-${{github.ref_name}}-standalone-win_amd64.zip
- name: Action | Upload Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: dist-exec-windows-latest
path: ./dist/sansmic-*-standalone-win_amd64.zip
publish-to-gh:
name: Upload artifacts
runs-on: ubuntu-latest
needs:
- build_win_exe
- make_sdist
- build_wheels
environment:
name: release
url: https://github.com/sandialabs/sansmic/releases/tag/${{github.ref_name}}
concurrency: release
permissions:
id-token: write
contents: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.sha }}
- name: Setup | Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Action | Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0
with:
inputs: >-
./dist/*.zip
./dist/*.tar.gz
./dist/*.whl
- name: Publish | Upload to GitHub Release Assets
run: |
gh release upload ${{github.ref_name}} dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-to-testpypi:
name: Publish Python π distribution π¦ to TestPyPI
runs-on: ubuntu-latest
needs: [publish-to-gh]
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'sandialabs/sansmic' }} # only publish to PyPI on tag pushes
environment:
name: testpypi
url: https://test.pypi.org/p/sansmic
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.sha }}
- name: Setup | Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: dist-cibw-*
path: dist
merge-multiple: true
- name: Action | Publish distribution π¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1
with:
skip-existing: true
print-hash: true
verbose: true
attestations: true
repository-url: https://test.pypi.org/legacy/
publish-to-pypi:
name: >-
Publish Python π distribution π¦ to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository == 'sandialabs/sansmic' }} # only publish to PyPI on tag pushes
needs: [publish-to-gh, publish-to-testpypi]
environment:
name: release
url: https://pypi.org/p/sansmic
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Setup | Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.sha }}
- name: Setup | Download all the dists
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: dist-cibw-*
path: dist
merge-multiple: true
- name: Setup | Publish distribution π¦ to PyPI
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1
with:
attestations: true
print-hash: true