|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - main
|
7 |
| - |
8 | 7 | jobs:
|
9 |
| - build: |
10 |
| - name: Build distribution |
| 8 | + publish-to-pypi: |
| 9 | + name: >- |
| 10 | + Publish to PyPI |
| 11 | + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
11 | 12 | runs-on: ubuntu-latest
|
12 |
| - |
| 13 | + environment: |
| 14 | + name: pypi |
| 15 | + url: https://pypi.org/p/pyoframe |
| 16 | + permissions: |
| 17 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
13 | 18 | steps:
|
14 | 19 | - uses: actions/checkout@v4
|
15 | 20 | - name: Set up Python
|
|
24 | 29 | --user
|
25 | 30 | - name: Build a binary wheel and a source tarball
|
26 | 31 | run: python3 -m build
|
27 |
| - - name: Store the distribution packages |
28 |
| - uses: actions/upload-artifact@v3 |
29 |
| - with: |
30 |
| - name: python-package-distributions |
31 |
| - path: dist/ |
32 |
| - |
33 |
| - publish-to-pypi: |
34 |
| - name: >- |
35 |
| - Publish to PyPI |
36 |
| - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
37 |
| - needs: |
38 |
| - - build |
39 |
| - runs-on: ubuntu-latest |
40 |
| - environment: |
41 |
| - name: pypi |
42 |
| - url: https://pypi.org/p/pyoframe # Replace <package-name> with your PyPI project name |
43 |
| - permissions: |
44 |
| - id-token: write # IMPORTANT: mandatory for trusted publishing |
45 |
| - |
46 |
| - steps: |
47 |
| - - name: Download all the dists |
48 |
| - uses: actions/download-artifact@v3 |
49 |
| - with: |
50 |
| - name: python-package-distributions |
51 |
| - path: dist/ |
52 | 32 | - name: Publish distribution 📦 to PyPI
|
53 | 33 | uses: pypa/gh-action-pypi-publish@release/v1
|
54 |
| - |
55 |
| - github-release: |
56 |
| - name: >- |
57 |
| - Publish to GitHub Releases |
58 |
| - needs: |
59 |
| - - publish-to-pypi |
60 |
| - runs-on: ubuntu-latest |
61 |
| - |
62 |
| - permissions: |
63 |
| - contents: write # IMPORTANT: mandatory for making GitHub Releases |
64 |
| - id-token: write # IMPORTANT: mandatory for sigstore |
65 |
| - |
66 |
| - steps: |
67 |
| - - name: Download all the dists |
68 |
| - uses: actions/download-artifact@v3 |
69 |
| - with: |
70 |
| - name: python-package-distributions |
71 |
| - path: dist/ |
72 |
| - - name: Sign the dists with Sigstore |
73 |
| - |
74 |
| - with: |
75 |
| - inputs: >- |
76 |
| - ./dist/*.tar.gz |
77 |
| - ./dist/*.whl |
78 |
| - - name: Create GitHub Release |
79 |
| - env: |
80 |
| - GITHUB_TOKEN: ${{ github.token }} |
81 |
| - run: >- |
82 |
| - gh release create |
83 |
| - '${{ github.ref_name }}' |
84 |
| - --repo '${{ github.repository }}' |
85 |
| - --notes "" |
86 |
| - - name: Upload artifact signatures to GitHub Release |
87 |
| - env: |
88 |
| - GITHUB_TOKEN: ${{ github.token }} |
89 |
| - # Upload to GitHub Release using the `gh` CLI. |
90 |
| - # `dist/` contains the built packages, and the |
91 |
| - # sigstore-produced signatures and certificates. |
92 |
| - run: >- |
93 |
| - gh release upload |
94 |
| - '${{ github.ref_name }}' dist/** |
95 |
| - --repo '${{ github.repository }}' |
0 commit comments