diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 0256193b6..9e10bba07 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -10,8 +10,6 @@ on: jobs: deploy_with_bdist_wheel: runs-on: ${{ matrix.os }} - permissions: - id-token: write strategy: matrix: os: [windows-latest, macos-11] diff --git a/.github/workflows/test_upload.yml b/.github/workflows/test_upload.yml deleted file mode 100644 index efa273ba9..000000000 --- a/.github/workflows/test_upload.yml +++ /dev/null @@ -1,85 +0,0 @@ -# This workflows will upload Python Package to testpypi using Twine when a release is created - - -name: Upload qlib package to testpypi - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - - -jobs: - deploy_with_bdist_wheel: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, macos-11] - # FIXME: macos-latest will raise error now. - # not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129 - python-version: [3.7, 3.8] - steps: - - uses: actions/checkout@v2 - # This is because on macos systems you can install pyqlib using - # `pip install pyqlib` installs, it does not recognize the - # `pyqlib--cp38-cp38-macosx_11_0_x86_64.whl` and `pyqlib--cp38-cp37m-macosx_11_0_x86_64.whl`. - # So we limit the version of python, in order to generate a version of qlib that is usable for macos: `pyqlib--cp38-cp37m - # `pyqlib--cp38-cp38-macosx_10_15_x86_64.whl` and `pyqlib--cp38-cp37m-macosx_10_15_x86_64.whl`. - # Python 3.7.16, 3.8.16 can build macosx_10_15. But Python 3.7.17, 3.8.17 can build macosx_11_0 - - name: Set up Python ${{ matrix.python-version }} - if: matrix.os == 'macos-11' && matrix.python-version == '3.7' - uses: actions/setup-python@v2 - with: - python-version: "3.7.16" - - name: Set up Python ${{ matrix.python-version }} - if: matrix.os == 'macos-11' && matrix.python-version == '3.8' - uses: actions/setup-python@v2 - with: - python-version: "3.8.16" - - name: Set up Python ${{ matrix.python-version }} - if: matrix.os != 'macos-11' - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build wheel on ${{ matrix.os }} - run: | - pip install numpy - pip install cython - python setup.py bdist_wheel - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }} - run: | - twine upload --repository-url https://test.pypi.org/legacy/ dist/* - - deploy_with_manylinux: - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - - uses: actions/checkout@v2 - - name: Build wheel on Linux - uses: RalfG/python-wheels-manylinux-build@v0.3.1-manylinux2010_x86_64 - with: - # not supporting 3.6 due to annotations is not supported https://stackoverflow.com/a/52890129 - python-versions: 'cp37-cp37m cp38-cp38' - build-requirements: 'numpy cython' - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: Install dependencies - run: | - pip install twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }} - run: | - twine upload --repository-url https://test.pypi.org/legacy/ dist/pyqlib-*-manylinux*.whl diff --git a/scripts/publish.py b/scripts/publish.py deleted file mode 100644 index a67d87b77..000000000 --- a/scripts/publish.py +++ /dev/null @@ -1,35 +0,0 @@ -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()