Skip to content

Commit cc7e029

Browse files
committed
Test build.yaml
1 parent 0c951be commit cc7e029

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

.github/workflows/publish.yaml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
name: Upload Python Package
1010

1111
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
1415

1516
permissions:
1617
contents: read
@@ -21,6 +22,8 @@ jobs:
2122

2223
steps:
2324
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2427

2528
- name: Set up Python
2629
uses: actions/setup-python@v4
@@ -30,11 +33,36 @@ jobs:
3033
- name: Install uv
3134
uses: astral-sh/setup-uv@v5
3235

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+
3360
- name: Build package
3461
run: uv build --no-sources
3562

36-
- name: Publish package
37-
uses: pypa/[email protected]
38-
with:
39-
user: __token__
40-
password: ${{ secrets.PYPI_API_TOKEN }}
63+
# - name: Publish package to PyPI
64+
# uses: pypa/[email protected]
65+
# with:
66+
# user: __token__
67+
# password: ${{ secrets.PYPI_API_TOKEN }}
68+
# verbose: true

0 commit comments

Comments
 (0)