Skip to content

Commit d0be235

Browse files
committed
update publish_package workflow to use cibuildwheels
1 parent 8fe1d83 commit d0be235

File tree

1 file changed

+59
-22
lines changed

1 file changed

+59
-22
lines changed

.github/workflows/publish_package.yml

+59-22
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,71 @@ jobs:
88
test_package:
99
uses: ./.github/workflows/test_package.yml
1010

11-
build:
11+
build_wheels:
1212
needs: test_package
13-
permissions:
14-
id-token: write
15-
contents: read
16-
runs-on: ubuntu-latest
13+
name: Build wheels on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
INSTALL_ENDF_PARSERPY_CPP: yes
17+
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
21+
1722
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
27+
- name: Install cibuildwheel
28+
run: python -m pip install cibuildwheel==2.18.1
29+
30+
- name: Build wheels
31+
run: python -m cibuildwheel --output-dir wheelhouse
32+
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
36+
path: ./wheelhouse/*.whl
37+
38+
make_sdist:
39+
name: Make source distribution package
40+
needs: test_package
41+
runs-on: ubuntu-latest
1842

19-
- uses: actions/checkout@v3
43+
steps:
44+
- uses: actions/checkout@v4
2045

21-
- uses: actions/setup-python@v4
46+
- uses: actions/setup-python@v5
2247
with:
23-
python-version: 3.x
48+
python-version: "3.x"
2449

25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install poetry
50+
- name: Install build
51+
run: python -m pip install build
2952

30-
- name: Build the package
31-
run: |
32-
poetry version $(git describe --tags --abbrev=0)
33-
poetry build
53+
- name: Build SDist
54+
run: python -m build --sdist
3455

35-
- name: Mint token
36-
id: mint-token
37-
uses: tschm/[email protected]
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: cibw-sdist
59+
path: dist/*.tar.gz
3860

39-
- name: Publish package
40-
run: |
41-
poetry publish -u __token__ -p '${{ steps.mint-token.outputs.api-token }}'
61+
upload_all:
62+
needs: [build_wheels, make_sdist]
63+
environment: pypi
64+
permissions:
65+
id-token: write
66+
runs-on: ubuntu-latest
67+
if: github.event_name == 'push'
68+
steps:
69+
- uses: actions/download-artifact@v4
70+
with:
71+
pattern: cibw-*
72+
path: dist
73+
merge-multiple: true
74+
75+
- uses: pypa/gh-action-pypi-publish@release/v1
76+
with:
77+
user: __token__
78+
password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)