mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-02 10:31:00 +08:00
add upload test
This commit is contained in:
3
.github/workflows/test_upload.yml
vendored
3
.github/workflows/test_upload.yml
vendored
@@ -50,6 +50,7 @@ jobs:
|
||||
run: |
|
||||
pip install numpy
|
||||
pip install cython
|
||||
python scripts/publish.py
|
||||
python setup.py bdist_wheel
|
||||
- name: Build and publish
|
||||
env:
|
||||
@@ -82,4 +83,4 @@ jobs:
|
||||
TWINE_USERNAME: __token__
|
||||
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}
|
||||
run: |
|
||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/pyqlib-*-manylinux*.whl
|
||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/pyqlib-*-manylinux*.whl
|
||||
|
||||
35
scripts/publish.py
Normal file
35
scripts/publish.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import re
|
||||
|
||||
|
||||
def read_file():
|
||||
with open("qlib/__init__.py", "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
return content
|
||||
|
||||
|
||||
def write_file(content: str):
|
||||
with open("qlib/__init__.py", "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def update_version(version_num: list):
|
||||
if len(version_num) == 3:
|
||||
new_version = f"{version_num[0]}.{version_num[1]}.{version_num[2]}.{1}"
|
||||
if len(version_num) == 4:
|
||||
new_version = f"{version_num[0]}.{version_num[1]}.{version_num[2]}.{int(version_num[3]) + 1}"
|
||||
return new_version
|
||||
|
||||
|
||||
def main():
|
||||
content = read_file()
|
||||
pattern = r"__version__ = \"(\d+(\.\d+)*(\.\d+)*)\""
|
||||
match = re.search(pattern, content)
|
||||
old_version = match.group(1)
|
||||
old_version_num = old_version.split(".")
|
||||
new_version = update_version(old_version_num)
|
||||
new_content = content.replace(old_version, new_version)
|
||||
write_file(new_content)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user