1 parent 2a95c22 commit e79e958Copy full SHA for e79e958
1 file changed
.github/workflows/python-publish.yml
@@ -1,12 +1,21 @@
1
+name: Publish to PyPI
2
+
3
+on:
4
+ push:
5
+ branches:
6
+ - main
7
8
jobs:
9
build-n-publish:
- name: Build and publish to PyPI (Python ${{ matrix.python-version }})
10
+ name: Build and publish (Python ${{ matrix.python-version }})
11
runs-on: ubuntu-latest
12
- # 使用策略矩陣 (Matrix Strategy)
13
+ # 設定矩陣策略
14
strategy:
15
matrix:
16
python-version: ["3.9", "3.10", "3.11"]
17
+ # 如果其中一個版本失敗,其他版本繼續執行
18
+ fail-fast: false
19
20
permissions:
21
id-token: write
@@ -29,4 +38,8 @@ jobs:
29
38
run: python -m build
30
39
31
40
- name: Publish package to PyPI
32
- uses: pypa/gh-action-pypi-publish@release/v1
41
+ uses: pypa/gh-action-pypi-publish@release/v1
42
+ with:
43
+ # 關鍵:允許上傳重複的版本檔案(因為多個 Job 會推同一個版號)
44
+ # 這樣 3.9 傳完後,3.10 傳的時候才不會因為版號相同而被 PyPI 擋掉
45
+ skip-existing: true
0 commit comments