Skip to content

Commit dd83e88

Browse files
authored
Use upload-download artifacts
1 parent e95e0f2 commit dd83e88

File tree

1 file changed

+51
-17
lines changed

1 file changed

+51
-17
lines changed

Diff for: .github/workflows/pypi_release.yml

+51-17
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
container:
2020
image: quay.io/pypa/manylinux2014_x86_64
2121
env:
22-
TWINE_USERNAME: "__token__"
23-
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
2422
PLAT: manylinux2014_x86_64
2523
PYBIN: '/opt/python/${{ matrix.python }}/bin'
2624
strategy:
@@ -63,10 +61,11 @@ jobs:
6361
run: |
6462
"${PYBIN}/pip" install cspy --no-index -f build/python/wheelhouse-repaired/
6563
"${PYBIN}/python3" -m unittest discover -s test/python/
66-
- name: upload wheel
67-
run: |
68-
${PYBIN}/pip install twine
69-
${PYBIN}/python3 -m twine upload build/python/wheelhouse-repaired/*
64+
- name: upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: linux-wheels
68+
path: build/python/wheelhouse-repaired/
7069
continue-on-error: true
7170

7271
macos-build:
@@ -76,9 +75,6 @@ jobs:
7675
matrix:
7776
os: [macos-12, macos-13, macos-14]
7877
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
79-
env:
80-
TWINE_USERNAME: "__token__"
81-
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
8278
steps:
8379
- uses: actions/checkout@v2
8480
- name: Set up Python ${{ matrix.python-version }}
@@ -103,10 +99,11 @@ jobs:
10399
delocate-wheel -w wheelhouse -v build/python/dist/*.whl
104100
cd build
105101
ctest --verbose -R python_unittest
106-
- name: upload wheel
107-
run: |
108-
python3 -m pip install twine
109-
twine upload wheelhouse/*
102+
- name: upload artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: macos-wheels
106+
path: wheelhouse/
110107
continue-on-error: true
111108

112109
windows-build:
@@ -132,8 +129,45 @@ jobs:
132129
run: |
133130
cd build
134131
ctest -C Release --verbose
135-
- name: upload wheel
136-
run: |
137-
pip install twine
138-
twine upload .\build\python\dist\*
132+
- name: upload artifact
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: windows-wheels
136+
path: build/python/dist/
139137
continue-on-error: true
138+
139+
pypi-publish:
140+
name: Upload release to PyPI
141+
needs: [build-manylinux2014-x86_64-wheel, macos-build, windows-build]
142+
runs-on: ubuntu-latest
143+
environment:
144+
name: pypi
145+
url: https://pypi.org/p/cspy
146+
permissions:
147+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
148+
steps:
149+
# retrieve your distributions here
150+
- uses: actions/download-artifact@v4
151+
with:
152+
name: linux-wheels
153+
path: allwheels
154+
- name: Display structure of Linux wheels
155+
run: ls -R allwheels
156+
- uses: actions/download-artifact@v4
157+
with:
158+
name: macos-wheels
159+
path: allwheels
160+
- uses: actions/download-artifact@v4
161+
with:
162+
name: windows-wheels
163+
path: allwheels
164+
- name: Display allwheels dir
165+
run: ls -R allwheels
166+
167+
- name: Publish package distributions to PyPI
168+
uses: pypa/gh-action-pypi-publish@release/v1
169+
with:
170+
packages-dir: allwheels
171+
verbose: true
172+
skip-existing: true
173+
password: ${{ secrets.PYPI_API_KEY }}

0 commit comments

Comments
 (0)