Skip to content

Commit fbf5ed7

Browse files
authored
Create python-publish.yml
1 parent ad37446 commit fbf5ed7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write # 必须启用用于 PyPI Trusted Publishing
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Install build tool
24+
run: python -m pip install --upgrade build
25+
26+
- name: Build distributions
27+
run: python -m build
28+
29+
- name: Upload build artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: release-dists
33+
path: dist/
34+
35+
publish:
36+
runs-on: ubuntu-latest
37+
needs: build
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/project/qsnctf/
41+
42+
steps:
43+
- name: Download build artifacts
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: release-dists
47+
path: dist/
48+
49+
- name: Publish to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
with:
52+
packages-dir: dist/

0 commit comments

Comments
 (0)