Skip to content

Commit 4facf77

Browse files
authored
ci: fix update PyPI versioning in CI workflow
Update PyPI versioning in CI workflow
2 parents b86c467 + 5847c08 commit 4facf77

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

‎.github/workflows/publish-pypi.yml‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,18 @@ jobs:
3434

3535
- name: Install maturin
3636
run: pip install maturin
37-
37+
38+
- name: Update release version
39+
shell: bash
40+
run: |
41+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
42+
43+
python -c "import re, pathlib; p = pathlib.Path('tp-py/pyproject.toml'); p.write_text(re.sub(r'^version = \".*\"', f'version = \"${TAG_VERSION}\"', p.read_text(), count=1, flags=re.M))"
44+
45+
python -c "import re, pathlib; p = pathlib.Path('Cargo.toml'); p.write_text(re.sub(r'^version = \".*\"', f'version = \"${TAG_VERSION}\"', p.read_text(), count=1, flags=re.M))"
46+
47+
python -c "import re, pathlib; p = pathlib.Path('tp-py/Cargo.toml'); p.write_text(re.sub(r'(tp-lib-core = \{[^}]*version = \")[^\"]+(\"[^}]*\})', lambda m: m.group(1) + '${TAG_VERSION}' + m.group(2), p.read_text()))"
48+
3849
- name: Build wheels
3950
run: |
4051
cd tp-py
@@ -63,7 +74,18 @@ jobs:
6374

6475
- name: Install maturin
6576
run: pip install maturin
66-
77+
78+
- name: Update release version
79+
shell: bash
80+
run: |
81+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
82+
83+
python -c "import re, pathlib; p = pathlib.Path('tp-py/pyproject.toml'); p.write_text(re.sub(r'^version = \".*\"', f'version = \"${TAG_VERSION}\"', p.read_text(), count=1, flags=re.M))"
84+
85+
python -c "import re, pathlib; p = pathlib.Path('Cargo.toml'); p.write_text(re.sub(r'^version = \".*\"', f'version = \"${TAG_VERSION}\"', p.read_text(), count=1, flags=re.M))"
86+
87+
python -c "import re, pathlib; p = pathlib.Path('tp-py/Cargo.toml'); p.write_text(re.sub(r'(tp-lib-core = \{[^}]*version = \")[^\"]+(\"[^}]*\})', lambda m: m.group(1) + '${TAG_VERSION}' + m.group(2), p.read_text()))"
88+
6789
- name: Build sdist
6890
run: |
6991
cd tp-py

0 commit comments

Comments
 (0)