|
@@ -7,23 +7,47 @@ on:
|
|
|
types: [created]
|
|
|
|
|
|
jobs:
|
|
|
- deploy:
|
|
|
+ build:
|
|
|
+ name: Build distribution 📦
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
steps:
|
|
|
- - uses: actions/checkout@v2
|
|
|
+ - uses: actions/checkout@v4
|
|
|
- name: Set up Python
|
|
|
- uses: actions/setup-python@v2
|
|
|
+ uses: actions/setup-python@v5
|
|
|
with:
|
|
|
python-version: "3.x"
|
|
|
- - name: Install dependencies
|
|
|
- run: |
|
|
|
- python -m pip install --upgrade pip
|
|
|
- pip install setuptools wheel twine
|
|
|
- - name: Build and publish
|
|
|
- env:
|
|
|
- TWINE_USERNAME: __token__
|
|
|
- TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
- run: |
|
|
|
- python setup.py sdist bdist_wheel
|
|
|
- twine upload --verbose dist/*
|
|
|
+ - name: Install pypa/build
|
|
|
+ run: >-
|
|
|
+ python3 -m
|
|
|
+ pip install
|
|
|
+ build
|
|
|
+ --user
|
|
|
+ - name: Build a binary wheel and a source tarball
|
|
|
+ run: python3 -m build
|
|
|
+ - name: Store the distribution packages
|
|
|
+ uses: actions/upload-artifact@v4
|
|
|
+ with:
|
|
|
+ name: python-package-distributions
|
|
|
+ path: dist/
|
|
|
+
|
|
|
+ deploy:
|
|
|
+ permissions:
|
|
|
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ needs:
|
|
|
+ - build
|
|
|
+ name: >-
|
|
|
+ Publish Python 🐍 distribution 📦 to PyPI
|
|
|
+ environment:
|
|
|
+ name: pypi
|
|
|
+ url: https://pypi.org/p/pySwitchbot
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - name: Download all the dists
|
|
|
+ uses: actions/download-artifact@v4
|
|
|
+ with:
|
|
|
+ name: python-package-distributions
|
|
|
+ path: dist/
|
|
|
+ - name: Publish package distributions to PyPI
|
|
|
+ uses: pypa/gh-action-pypi-publish@release/v1
|