| 1 |
|
| 2 |
|
| 3 |
name: Upload Python Package |
| 4 |
|
| 5 |
on: |
| 6 |
release: |
| 7 |
types: [created] |
| 8 |
|
| 9 |
jobs: |
| 10 |
build: |
| 11 |
name: Build distribution 📦 |
| 12 |
runs-on: ubuntu-latest |
| 13 |
|
| 14 |
steps: |
| 15 |
- uses: actions/checkout@v4 |
| 16 |
- name: Set up Python |
| 17 |
uses: actions/setup-python@v5 |
| 18 |
with: |
| 19 |
python-version: "3.x" |
| 20 |
- name: Install pypa/build |
| 21 |
run: >- |
| 22 |
python3 -m |
| 23 |
pip install |
| 24 |
build |
| 25 |
--user |
| 26 |
- name: Build a binary wheel and a source tarball |
| 27 |
run: python3 -m build |
| 28 |
- name: Store the distribution packages |
| 29 |
uses: actions/upload-artifact@v4 |
| 30 |
with: |
| 31 |
name: python-package-distributions |
| 32 |
path: dist/ |
| 33 |
|
| 34 |
deploy: |
| 35 |
permissions: |
| 36 |
id-token: write |
| 37 |
runs-on: ubuntu-latest |
| 38 |
needs: |
| 39 |
- build |
| 40 |
name: >- |
| 41 |
Publish Python 🐍 distribution 📦 to PyPI |
| 42 |
environment: |
| 43 |
name: pypi |
| 44 |
url: https://pypi.org/p/pySwitchbot |
| 45 |
|
| 46 |
steps: |
| 47 |
- name: Download all the dists |
| 48 |
uses: actions/download-artifact@v4 |
| 49 |
with: |
| 50 |
name: python-package-distributions |
| 51 |
path: dist/ |
| 52 |
- name: Publish package distributions to PyPI |
| 53 |
uses: pypa/gh-action-pypi-publish@release/v1 |