|
1 | 1 | name: Publish Python 🐍 distributions 📦 to PyPI |
2 | 2 |
|
3 | | -on: |
| 3 | +on: |
4 | 4 | release: |
5 | 5 | types: [published] |
6 | 6 |
|
|
9 | 9 | name: Build and publish Python 🐍 distributions 📦 to PyPI |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | steps: |
12 | | - - name: get latest release with tag |
13 | | - id: latestrelease |
14 | | - run: | |
15 | | - echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/dcnieho/I2MC_Python/releases/latest | jq '.tag_name' | sed 's/\"//g')" |
16 | | - - name: confirm release tag |
17 | | - run: | |
18 | | - echo ${{ steps.latestrelease.outputs.releasetag }} |
19 | | - - name: tagcheckout |
20 | | - uses: actions/checkout@v3 |
21 | | - with: |
22 | | - ref: ${{ steps.latestrelease.outputs.releasetag }} |
23 | | - - name: Set up Python 3.10 |
24 | | - uses: actions/setup-python@v4 |
| 12 | + - name: Clone repo |
| 13 | + uses: actions/checkout@v5 |
| 14 | + |
| 15 | + - name: Setup python |
| 16 | + uses: actions/setup-python@v6 |
25 | 17 | with: |
26 | | - python-version: '3.10' |
| 18 | + python-version: "3.11.x" |
| 19 | + |
27 | 20 | - name: Install pypa/build |
28 | 21 | run: >- |
29 | 22 | python -m |
30 | 23 | pip install |
31 | 24 | build |
32 | 25 | --user |
33 | | - - name: Build a binary wheel and a source tarball |
| 26 | +
|
| 27 | + - name: Build a wheel and a source tarball |
34 | 28 | run: >- |
35 | 29 | python -m |
36 | 30 | build |
37 | 31 | --sdist |
38 | 32 | --wheel |
39 | 33 | --outdir dist/ |
| 34 | +
|
| 35 | + - name: "Upload wheel as workflow artifact" |
| 36 | + uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: wheel |
| 39 | + path: ./dist/*.whl |
| 40 | + |
| 41 | + - name: Upload wheel as release artifact |
| 42 | + uses: softprops/action-gh-release@v2 |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 45 | + with: |
| 46 | + files: "./dist/*.whl" |
| 47 | + |
40 | 48 | - name: Publish distribution 📦 to PyPI |
41 | | - |
| 49 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 50 | + |
42 | 51 | with: |
43 | 52 | password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments