Skip to content

Commit 2514d49

Browse files
prompt-botSimsonW
authored andcommitted
fix: 更新actions
1 parent a854c16 commit 2514d49

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

.github/workflows/release-publish.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
3+
on:
4+
create:
5+
tags:
6+
- 'v*'
7+
push:
8+
branches: [ "master", "dev" ]
9+
10+
jobs:
11+
publish-to-pypi:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- uses: actions/checkout@master
16+
17+
- name: Set up Python 3.11
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: 3.11
21+
22+
- name: Install build
23+
run: >-
24+
pip install -r requirements.txt
25+
python setup.py sdist
26+
27+
- name: Publish distribution 📦 to Test PyPI
28+
uses: pypa/gh-action-pypi-publish@master
29+
with:
30+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
31+
repository_url: https://test.pypi.org/legacy/
32+
33+
- name: Publish distribution 📦 to Test PyPI
34+
if: startsWith(github.ref, 'refs/dev')
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
38+
repository_url: https://test.pypi.org/legacy/
39+
skip_existing: true
40+
41+
- name: Publish distribution 📦 to PyPI
42+
if: startsWith(github.ref, 'refs/tags/')
43+
uses: pypa/gh-action-pypi-publish@master
44+
with:
45+
password: ${{ secrets.PYPI_API_TOKEN }}
46+
47+
github-release:
48+
name: >-
49+
Sign the Python 🐍 distribution 📦 with Sigstore
50+
and upload them to GitHub Release
51+
needs:
52+
- publish-to-pypi
53+
runs-on: ubuntu-latest
54+
permissions:
55+
contents: write
56+
id-token: write
57+
steps:
58+
- name: Download all the dists
59+
uses: actions/download-artifact@v3
60+
with:
61+
name: python-package-distributions
62+
path: dist/
63+
- name: Sign the dists with Sigstore
64+
uses: sigstore/[email protected]
65+
with:
66+
inputs: >-
67+
./dist/*.tar.gz
68+
./dist/*.whl
69+
- name: Create GitHub Release
70+
env:
71+
GITHUB_TOKEN: ${{ github.token }}
72+
run: >-
73+
gh release create
74+
'${{ github.ref_name }}'
75+
--repo '${{ github.repository }}'
76+
--notes ""
77+
- name: Upload artifact signatures to GitHub Release
78+
env:
79+
GITHUB_TOKEN: ${{ github.token }}
80+
run: >-
81+
gh release upload
82+
'${{ github.ref_name }}' dist/**
83+
--repo '${{ github.repository }}'

.github/workflows/test-publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on:
2+
push:
3+
branches: [ dev ]
4+
5+
jobs:
6+
publish-to-pypi:
7+
name: Build and publish distributions to TestPyPI
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@master
11+
12+
- name: Set up Python 3.11
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: 3.11
16+
17+
- name: Install build
18+
run: >-
19+
pip install -r requirements.txt
20+
python setup.py sdist
21+
22+
- name: Publish distribution 📦 to Test PyPI
23+
uses: pypa/gh-action-pypi-publish@master
24+
with:
25+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
26+
repository_url: https://test.pypi.org/legacy/
27+
skip_existing: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ target/
6666
.idea/
6767

6868
.DS_Store
69+
.venv

0 commit comments

Comments
 (0)