9
9
name : Upload Python Package
10
10
11
11
on :
12
- release :
13
- types : [published]
12
+ push :
13
+ tags :
14
+ - ' v*' # Push events to matching v*, i.e. v1.0, v20.15.10, v0.1.0.dev1
14
15
15
16
permissions :
16
17
contents : read
21
22
22
23
steps :
23
24
- uses : actions/checkout@v4
25
+ with :
26
+ fetch-depth : 0
24
27
25
28
- name : Set up Python
26
29
uses : actions/setup-python@v4
@@ -30,11 +33,36 @@ jobs:
30
33
- name : Install uv
31
34
uses : astral-sh/setup-uv@v5
32
35
36
+ - name : Install dependencies
37
+ run : |
38
+ uv pip install toml
39
+
40
+ - name : Extract version from tag and update pyproject.toml
41
+ run : |
42
+ # Get the version from the tag (remove 'v' prefix)
43
+ TAG_VERSION=${GITHUB_REF#refs/tags/v}
44
+ echo "Tag version: $TAG_VERSION"
45
+
46
+ # Update pyproject.toml with the version from the tag
47
+ python -c "
48
+ import toml
49
+ data = toml.load('pyproject.toml')
50
+ original_version = data['project']['version']
51
+ data['project']['version'] = '$TAG_VERSION'
52
+ with open('pyproject.toml', 'w') as f:
53
+ toml.dump(data, f)
54
+ print(f'Version updated in pyproject.toml: {original_version} -> {data[\"project\"][\"version\"]}')
55
+ "
56
+
57
+ # Verify the change
58
+ cat pyproject.toml | grep version
59
+
33
60
- name : Build package
34
61
run : uv build --no-sources
35
62
36
- - name : Publish package
37
-
38
- with :
39
- user : __token__
40
- password : ${{ secrets.PYPI_API_TOKEN }}
63
+ # - name: Publish package to PyPI
64
+
65
+ # with:
66
+ # user: __token__
67
+ # password: ${{ secrets.PYPI_API_TOKEN }}
68
+ # verbose: true
0 commit comments