Debian Codegraph @

.github/workflows/pypi.yml

raw
1 # Workflow to handle builds and publishing to PyPi
2
3 name: Build into a Python Package Using SetupTools and Publish
4
5 on:
6 push:
7 branches:
8 - main
9 pull_request:
10 branches:
11 - main
12
13 jobs:
14 setup_and_build:
15 name: Build packages
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@v4
19 - name: Set up Python
20 uses: actions/setup-python@v5
21 with:
22 python-version: "3.x"
23 - name: Install and ensure pip
24 run: |
25 python3 -m pip install --upgrade pip
26 - name: Install python build
27 run: |
28 pip install build --user
29 - name: Build sdist and wheel
30 run: |
31 python3 -m build --outdir dist/
32 - name: Upload dist for publishing
33 uses: actions/upload-artifact@v4
34 with:
35 name: dist
36 path: |
37 dist/
38 retention-days: 1
39
40 publish_TestPyPi:
41 name: Publish to TestPyPi
42 runs-on: ubuntu-latest
43 needs: setup_and_build
44 environment:
45 name: testpypi
46 url: https://test.pypi.org/p/ayla_iot_unofficial
47 permissions:
48 id-token: write
49 steps:
50 - name: Get dist from build job
51 uses: actions/download-artifact@v4
52 - name: Publish to TestPyPi
53 uses: pypa/[email protected]
54 with:
55 password: ${{ secrets.TEST_PYPI_API_TOKEN }}
56 repository-url: https://test.pypi.org/legacy/
57
58 publish_PyPi:
59 name: Publish to PyPi
60 runs-on: ubuntu-latest
61 needs: setup_and_build
62 environment:
63 name: pypi
64 url: https://pypi.org/p/ayla-iot-unofficial
65 permissions:
66 id-token: write
67 steps:
68 - name: Get dist from build job
69 uses: actions/download-artifact@v4
70 - name: Publish to PyPi
71 uses: pypa/[email protected]
72 with:
73 password: ${{ secrets.PYPI_API_TOKEN }}