|
1 | 1 | name: Publish python package |
2 | 2 | description: |- |
3 | | - A github action to publish a python package to pypi.org or test.pypi.org. |
| 3 | + A github action to publish a python package to test.pypi.org and pypi.org. |
4 | 4 | Input options: |
5 | | - - `pypi: test.pypi` or `pypi: upload.pypi`: Publish to test.pypi or pypi.org. |
6 | | - Invoke with `uses: glenn20/python-ci/publish@v1` |
| 5 | + - `test-only`: Publish only to test.pypi.org if set to `true` (default). |
| 6 | + Invoke with `uses: glenn20/python-ci/publish@v2` |
7 | 7 | author: glenn20 |
| 8 | + |
8 | 9 | inputs: |
9 | | - pypi: |
10 | | - description: 'Set to "upload.pypi" or "test.pypi" (default).' |
11 | | - default: 'test.pypi' |
| 10 | + test-only: |
| 11 | + description: 'Publish only to test.pypi if `true` (default).' |
| 12 | + default: 'true' |
12 | 13 | required: false |
13 | | - type: string |
14 | | -# secrets: |
15 | | -# pypi_token: |
16 | | -# description: 'PyPI API token' |
17 | | -# default: '' |
18 | | -# required: false |
19 | | -# type: string |
| 14 | + |
20 | 15 | outputs: |
21 | 16 | package-name: |
22 | 17 | description: 'Name of the package' |
@@ -48,17 +43,17 @@ runs: |
48 | 43 | >> $GITHUB_OUTPUT |
49 | 44 | shell: bash |
50 | 45 |
|
51 | | - - name: Publish python package |
| 46 | + - name: Publish python package to test.pypi |
52 | 47 | run: uv publish |
53 | 48 | env: |
54 | | - UV_PUBLISH_URL: https://${{ inputs.pypi }}.org/legacy/ |
| 49 | + UV_PUBLISH_URL: https://test.pypi.org/legacy/ |
55 | 50 | # UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }} |
56 | 51 | shell: bash |
57 | 52 |
|
58 | | - # - name: Publish python package |
59 | | - # uses: pypa/gh-action-pypi-publish@release/v1 |
60 | | - # with: |
61 | | - # repository-url: https://${{ inputs.pypi }}.org/legacy/ |
62 | | - # # password: ${{ secrets.pypi_token }} |
63 | | - # verbose: true |
64 | | - |
| 53 | + - name: Publish python package to pypi.org |
| 54 | + if: ${{ inputs.test-only != 'true' }} |
| 55 | + run: uv publish |
| 56 | + env: |
| 57 | + UV_PUBLISH_URL: https://pypi.org/legacy/ |
| 58 | + # UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }} |
| 59 | + shell: bash |
0 commit comments