|
1 | | -name: Release |
| 1 | +name: Publish Python 🐍 distribution 📦 to PyPI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | build: |
| 10 | + name: Build distribution 📦 |
10 | 11 | if: github.repository == 'mozilla-services/python-dockerflow' |
11 | 12 | runs-on: ubuntu-latest |
12 | 13 |
|
13 | 14 | steps: |
14 | | - - uses: actions/checkout@v2 |
| 15 | + - uses: actions/checkout@v4 |
15 | 16 | with: |
16 | 17 | fetch-depth: 0 |
17 | 18 |
|
18 | 19 | - name: Set up Python |
19 | | - uses: actions/setup-python@v2 |
| 20 | + uses: actions/setup-python@v5 |
20 | 21 | with: |
21 | 22 | python-version: 3.8 |
22 | 23 |
|
23 | | - - name: Install dependencies |
24 | | - run: | |
25 | | - python -m pip install -U pip |
26 | | - python -m pip install -U setuptools twine wheel |
27 | | -
|
28 | | - - name: Build packages |
29 | | - run: | |
30 | | - python setup.py --version |
31 | | - python setup.py sdist --format=gztar bdist_wheel |
32 | | - twine check dist/* |
33 | | -
|
34 | | - - name: Upload packages to PyPI |
35 | | - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
36 | | - run: twine upload dist/* |
37 | | - env: |
38 | | - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
39 | | - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
| 24 | + - name: Install pypa/build |
| 25 | + run: python3 -m pip install build |
| 26 | + |
| 27 | + - name: Build a binary wheel and a source tarball |
| 28 | + run: python3 -m build |
| 29 | + |
| 30 | + - name: Store the distribution packages |
| 31 | + uses: actions/upload-artifact@v3 |
| 32 | + with: |
| 33 | + name: python-package-distributions |
| 34 | + path: dist/ |
| 35 | + |
| 36 | + publish-to-pypi: |
| 37 | + name: Publish Python 🐍 distribution 📦 to PyPI |
| 38 | + needs: |
| 39 | + - build |
| 40 | + runs-on: ubuntu-latest |
| 41 | + environment: |
| 42 | + name: release |
| 43 | + url: https://pypi.org/p/dockerflow |
| 44 | + permissions: |
| 45 | + id-token: write |
| 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 distribution 📦 to PyPI |
| 53 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments