■ ■ ■ ■ ■ ■
.github/workflows/pypi.yml
1 | | - | name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
2 | | - | |
3 | | - | on: push |
4 | | - | jobs: |
5 | | - | build-n-publish: |
6 | | - | name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
7 | | - | runs-on: ubuntu-latest |
8 | | - | steps: |
9 | | - | - uses: actions/checkout@master |
10 | | - | - name: Set up Python 3.10 |
11 | | - | uses: actions/setup-python@v3 |
12 | | - | with: |
13 | | - | python-version: "3.10" |
14 | | - | - name: Install pypa/build |
15 | | - | run: >- |
16 | | - | python -m |
17 | | - | pip install |
18 | | - | build |
19 | | - | --user |
20 | | - | - name: Install twine |
21 | | - | run: pip install twine |
22 | | - | - name: Build a binary wheel and a source tarball |
23 | | - | run: >- |
24 | | - | python -m |
25 | | - | build |
26 | | - | --sdist |
27 | | - | --wheel |
28 | | - | --outdir dist/ |
29 | | - | . |
30 | | - | - name: Publish distribution 📦 to Test PyPI |
31 | | - | uses: pypa/gh-action-pypi-publish@release/v1 |
32 | | - | with: |
33 | | - | password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
34 | | - | repository_url: https://test.pypi.org/legacy/ |
35 | | - | - name: Publish distribution 📦 to PyPI |
36 | | - | if: startsWith(github.ref, 'refs/tags') |
37 | | - | uses: pypa/gh-action-pypi-publish@release/v1 |
38 | | - | with: |
39 | | - | password: ${{ secrets.PYPI_API_TOKEN }} |
40 | | - | |