-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
66 lines (58 loc) · 1.9 KB
/
action.yaml
File metadata and controls
66 lines (58 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Publish python package
author: glenn20
description: |-
A github action to publish a python package to test.pypi.org and pypi.org.
Invoke with `uses: glenn20/python-ci/publish@v2`
Inputs:
- `test-only`: Publish only to test.pypi.org if set to `true` (default).
Outputs:
- `package-name`: Name of the package.
- `package-version`: Version number of the package.
- `url`: URL of the package on pypi.org (or test.pypi.org).
inputs:
test-only:
description: 'Publish only to test.pypi if `true` (default).'
default: 'true'
required: false
outputs:
package-name:
description: 'Name of the package'
value: ${{ steps.package-name.outputs.name }}
package-version:
description: 'Version number of the package'
value: ${{ steps.package-name.outputs.version }}
url:
description: 'URL of the package on pypi.org (or test.pypi.org)'
value: https://${{ (inputs.test-only == 'true') && 'test.' || '' }}pypi.org/p/${{ steps.package-name.outputs.name }}
runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Get package name and version
id: package-name
shell: bash
run: >-
ls dist/*.whl
| sed 's/^.*\/\([^-]*\)-\([^-]*\)-.*$/name=\1\nversion=\2/;1q'
| sed '/^name=/s/_/-/g'
>> $GITHUB_OUTPUT
- name: Publish to test.pypi
shell: bash
run: uv publish
env:
UV_PUBLISH_URL: https://test.pypi.org/legacy/
# UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }}
- name: Publish to pypi.org
if: ${{ inputs.test-only != 'true' }}
shell: bash
run: uv publish
env:
UV_PUBLISH_URL: https://upload.pypi.org/legacy/
# UV_PUBLISH_TOKEN: ${{ secrets.pypi_token }}