-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (53 loc) · 1.73 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (53 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: 发布到 PyPI
on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: packages/pole-client-python/pyproject.toml
- name: 校验发布版本
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
version="$(python -c 'import tomllib; print(tomllib.load(open("packages/pole-client-python/pyproject.toml", "rb"))["project"]["version"])')"
test "$RELEASE_TAG" = "v$version" || {
echo "Release 标签 $RELEASE_TAG 与 pole-client-python 版本 v$version 不一致"
exit 1
}
- run: python -m pip install --upgrade pip
- run: python -m pip install './packages/pole-client-python[dev]'
- run: >-
PYTHONPATH=packages/pole-client-python/src
python -m unittest discover -s packages/pole-client-python/tests -v
- run: >-
python -m build
--outdir packages/pole-client-python/dist
packages/pole-client-python
- uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: packages/pole-client-python/dist/
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pole-client-python/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v5
with:
name: python-package-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1