Skip to content

Commit 50aaccd

Browse files
committed
Updated deploy workflow
1 parent 070100f commit 50aaccd

File tree

1 file changed

+52
-15
lines changed

1 file changed

+52
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ on:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
77

88
jobs:
9-
deploy-job:
9+
build_locally:
10+
name: Build locally
1011
runs-on: ubuntu-latest
1112
steps:
1213
- name: Check out repository code
13-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1415
- name: Install Python
1516
uses: actions/setup-python@v4
1617
with:
@@ -19,19 +20,55 @@ jobs:
1920
run: |
2021
python -m pip install twine build
2122
python -m pip install -e .
22-
- name: Build package
23+
- name: Build package locally
2324
run: |
2425
python -m build
2526
python -m twine check dist/*
26-
- name: Upload package to TestPyPI
27-
run: |
28-
python -m twine upload -r testpypi dist/* --verbose
29-
env:
30-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME_TEST }}
31-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }}
32-
- name: Upload package to PyPI
33-
run: |
34-
python -m twine upload -r pypi dist/* --verbose
35-
env:
36-
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
37-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
27+
28+
build_wheels:
29+
name: Build wheels on ${{ matrix.os }}
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Build wheels
37+
uses: pypa/cibuildwheel@v2.19.2
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
41+
path: ./wheelhouse/*.whl
42+
43+
build_sdist:
44+
name: Build source distribution
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Build sdist
50+
run: pipx run build --sdist
51+
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: cibw-sdist
55+
path: dist/*.tar.gz
56+
57+
upload_pypi:
58+
needs: [build_wheels, build_sdist]
59+
runs-on: ubuntu-latest
60+
environment: pypi
61+
permissions:
62+
id-token: write
63+
steps:
64+
- uses: actions/download-artifact@v4
65+
with:
66+
# unpacks all CIBW artifacts into dist/
67+
pattern: cibw-*
68+
path: dist
69+
merge-multiple: true
70+
71+
- uses: pypa/gh-action-pypi-publish@release/v1
72+
with:
73+
# To test:
74+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)