Skip to content

Commit 7fe72ff

Browse files
committed
update: workflow
1 parent d53a2e5 commit 7fe72ff

File tree

1 file changed

+44
-33
lines changed

1 file changed

+44
-33
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,56 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
pypi-publish:
11-
name: Upload release to PyPI
10+
build-wheels:
11+
runs-on: ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
1414
matrix:
1515
include:
1616
- os: ubuntu-latest
17-
target-platform: linux-x86_64
17+
target-wheel: manylinux1_x86_64.whl
1818
- os: ubuntu-latest
19-
target-platform: linux-aarch64
19+
target-wheel: manylinux_2_17_aarch64.manylinux2014_aarch64.whl
2020
- os: windows-latest
21-
target-platform: win-64
22-
- os: macos-latest-large
23-
target-platform: osx-intel
24-
- os: macos-latest-xlarge
25-
target-platform: osx-arm64
21+
target-wheel: win_amd64.whl
22+
- os: windows-latest
23+
target-wheel: win_arm64.whl
2624

27-
runs-on: ${{ matrix.os }}
2825
steps:
29-
- uses: actions/checkout@master
30-
- name: Set up Python
31-
uses: actions/setup-python@v1
32-
with:
33-
python-version: "3.x"
34-
- name: Install pypa/build
35-
run: >-
36-
python -m
37-
pip install
38-
build
39-
--user
40-
- name: Build a binary wheel and a source tarball
41-
run: >-
42-
python -m
43-
build
44-
--sdist
45-
--wheel
46-
--outdir dist/
47-
.
48-
- name: Publish distribution to PyPI
49-
uses: pypa/gh-action-pypi-publish@release/v1
50-
with:
51-
password: ${{ secrets.PYPI_API_TOKEN }}
26+
- uses: actions/checkout@v4
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: "3.x"
31+
- name: Install dependencies
32+
run: python -m pip install build wheel
33+
- name: Build wheel
34+
env:
35+
PLAYWRIGHT_firefox_TARGET_WHEEL: ${{ matrix.target-wheel }}
36+
run: python setup.py bdist_wheel
37+
38+
- name: Upload built wheel as artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: wheel-${{ matrix.target-wheel }}
42+
path: dist/*.whl
43+
44+
# 只用linux amd64上传 PyPI
45+
pypi-publish:
46+
name: Publish to PyPI
47+
runs-on: ubuntu-latest
48+
needs: build-wheels
49+
steps:
50+
- uses: actions/download-artifact@v4
51+
with:
52+
pattern: wheel-*
53+
merge-multiple: true
54+
path: dist
55+
- name: Set up Python
56+
uses: actions/setup-python@v4
57+
with:
58+
python-version: "3.x"
59+
- name: Install twine
60+
run: python -m pip install twine
61+
- name: Publish to PyPI
62+
run: python -m twine upload dist/*.whl --non-interactive -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)