feat: ci.

This commit is contained in:
yassun7010 2024-11-24 20:37:18 +09:00
parent 1f5e60a890
commit df86885867
2 changed files with 26 additions and 0 deletions

View file

@ -35,6 +35,8 @@ jobs:
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python python/set_version.py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
@ -63,6 +65,8 @@ jobs:
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python python/set_version.py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
@ -87,6 +91,8 @@ jobs:
target: x86
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python python/set_version.py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
@ -110,6 +116,8 @@ jobs:
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python python/set_version.py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
@ -126,6 +134,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: python python/set_version.py
- name: Build sdist
uses: PyO3/maturin-action@v1
with:

16
python/set_version.py Normal file
View file

@ -0,0 +1,16 @@
import os
from pathlib import Path
project_root = Path(__file__).parents[1].absolute()
pyproject_toml_path = project_root / "pyproject.toml"
with open(pyproject_toml_path, "r") as f:
contents = f.read()
with open(pyproject_toml_path, "w") as f:
if (github_ref := os.getenv("GITHUB_REF")) and github_ref.startswith("refs/tags/"):
version = github_ref.replace("refs/tags/v", "")
contents = contents.replace('version = "0.0.0"', f'version = "{version}"')
f.write(contents)