diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 6dcef48..94bb476 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -34,7 +34,18 @@ jobs: - name: Install maturin run: pip install maturin - + + - name: Update release version + shell: bash + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + + 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))" + + 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))" + + 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()))" + - name: Build wheels run: | cd tp-py @@ -63,7 +74,18 @@ jobs: - name: Install maturin run: pip install maturin - + + - name: Update release version + shell: bash + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + + 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))" + + 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))" + + 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()))" + - name: Build sdist run: | cd tp-py