Skip to content

Commit 993f923

Browse files
committed
Update logic to alter pyproject version before publishing.
1 parent 84bc824 commit 993f923

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/publish_package.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
permissions:
1212
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

1616
- name: Set up Python 3.12
1717
uses: actions/setup-python@v4
@@ -27,7 +27,14 @@ jobs:
2727

2828
- name: Update version in pyproject.toml
2929
run: |
30-
sed -i "s/version = \".*\"/version = \"${{ env.VERSION }}\"/" pyproject.toml
30+
python -c "
31+
import tomlkit
32+
with open('pyproject.toml', 'r') as f:
33+
content = tomlkit.load(f)
34+
content['project']['version'] = '${{ env.VERSION }}'
35+
with open('pyproject.toml', 'w') as f:
36+
tomlkit.dump(content, f)
37+
"
3138
3239
- name: Build distribution
3340
run: python -m build --sdist --wheel --outdir dist/

0 commit comments

Comments
 (0)