返回 ViMax
publish-pypi.yml
根目录 / .github / workflows / publish-pypi.yml
1 name: Publish to PyPI
2
3 on:
4 workflow_dispatch:
5
6 permissions: {}
7
8 concurrency:
9 group: publish-pypi
10 cancel-in-progress: false
11
12 jobs:
13 build:
14 if: github.ref == 'refs/heads/main'
15 runs-on: ubuntu-latest
16 permissions:
17 contents: read
18 steps:
19 - name: Check out the release commit
20 uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21 with:
22 persist-credentials: false
23 - name: Set up Python
24 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
25 with:
26 python-version: '3.12'
27 - name: Build and validate distributions
28 run: |
29 python -m pip install build twine
30 python -m build
31 python -m twine check --strict dist/*
32 - name: Save the checked distributions
33 uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
34 with:
35 name: python-distributions
36 path: dist/
37 if-no-files-found: error
38
39 publish:
40 needs: build
41 runs-on: ubuntu-latest
42 environment:
43 name: pypi
44 url: https://pypi.org/project/vimax/
45 permissions:
46 id-token: write
47 steps:
48 - name: Download the checked distributions
49 uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
50 with:
51 name: python-distributions
52 path: dist/
53 - name: Publish distributions to PyPI
54 uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
55
55 lines YAML