|
1 | | -# This workflows will upload a Python Package using Twine when a release is created |
2 | | -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
| 1 | +# This workflows will upload a Python Package to PyPI when a new release is created. |
| 2 | +# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/# |
3 | 3 |
|
4 | 4 | name: Upload Python Package |
5 | 5 |
|
|
8 | 8 | types: [created] |
9 | 9 |
|
10 | 10 | jobs: |
| 11 | + build: |
| 12 | + name: Build distribution 📦 |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Check-out repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + persist-credentials: false |
| 20 | + - name: Set up Python |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.x" |
| 24 | + - name: Install dependencies |
| 25 | + run: >- |
| 26 | + python3 -m |
| 27 | + pip install |
| 28 | + build |
| 29 | + --user |
| 30 | + - name: Build a binary wheel and a source tarball |
| 31 | + run: python3 -m build |
| 32 | + - name: Store the distribution packages |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: python-package-distributions |
| 36 | + path: dist/ |
| 37 | + - name: Verify dist directory |
| 38 | + run: ls -l dist |
11 | 39 | pypi-publish: |
| 40 | + name: Publish to PyPI |
| 41 | + needs: |
| 42 | + - build |
12 | 43 | runs-on: ubuntu-latest |
13 | 44 | environment: |
14 | 45 | name: pypi |
15 | 46 | url: https://pypi.org/p/cjio |
16 | 47 | permissions: |
17 | 48 | id-token: write |
18 | 49 | steps: |
19 | | - - name: Check-out repository |
20 | | - uses: actions/checkout@v2 |
21 | | - - name: Set up Python |
22 | | - uses: actions/setup-python@v2 |
| 50 | + - name: Download all the dists |
| 51 | + uses: actions/download-artifact@v4 |
23 | 52 | with: |
24 | | - python-version: '3.x' |
25 | | - - name: Install dependencies |
26 | | - run: | |
27 | | - python -m pip install --upgrade pip |
28 | | - pip install setuptools wheel twine |
| 53 | + name: python-package-distributions |
| 54 | + path: dist/ |
29 | 55 | - name: Publish to PyPI |
30 | 56 | uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments