|
1 | | -name: upload-package |
| 1 | +# Upload python package to pypi server and github release. |
| 2 | +# Reference: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ |
| 3 | + |
| 4 | +name: Upload Python Package |
2 | 5 |
|
3 | 6 | on: |
4 | 7 | release: |
5 | 8 | types: [published] |
6 | 9 |
|
7 | 10 | jobs: |
8 | | - github-release: |
| 11 | + publish-to-pypi: |
9 | 12 | name: >- |
10 | | - Sign the Python distribution with Sigstore |
11 | | - and upload them to GitHub Release |
| 13 | + Publish distribution to PyPI |
12 | 14 | runs-on: ubuntu-latest |
| 15 | + environment: |
| 16 | + name: pypi |
| 17 | + url: https://pypi.org/p/nomad-normalizer-plugin-simulation-workflow |
13 | 18 | permissions: |
14 | | - contents: write # IMPORTANT: mandatory for making GitHub Releases |
15 | | - id-token: write # IMPORTANT: mandatory for sigstore |
16 | | - |
| 19 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 20 | + |
17 | 21 | steps: |
18 | 22 | - uses: actions/checkout@v4 |
19 | 23 | - name: Set up Python |
|
28 | 32 | --user |
29 | 33 | - name: Build a binary wheel and a source tarball |
30 | 34 | run: python3 -m build |
31 | | - - name: Sign the dists with Sigstore |
32 | | - |
33 | | - with: |
34 | | - inputs: >- |
35 | | - ./dist/*.tar.gz |
36 | | - ./dist/*.whl |
37 | | - - name: Create GitHub Release |
38 | | - env: |
39 | | - GITHUB_TOKEN: ${{ github.token }} |
40 | | - run: >- |
41 | | - gh release create |
42 | | - '${{ github.ref_name }}' |
43 | | - --repo '${{ github.repository }}' |
44 | | - --notes "" |
45 | | - - name: Upload artifact signatures to GitHub Release |
46 | | - env: |
47 | | - GITHUB_TOKEN: ${{ github.token }} |
48 | | - # Upload to GitHub Release using the `gh` CLI. |
49 | | - # `dist/` contains the built packages, and the |
50 | | - # sigstore-produced signatures and certificates. |
51 | | - run: >- |
52 | | - gh release upload |
53 | | - '${{ github.ref_name }}' dist/** |
54 | | - --repo '${{ github.repository }}' |
| 35 | + - name: Publish distribution to PyPI |
| 36 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments