diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..ed1fc6d5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: Build and Publish bittensor-cli + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to release' + required: true + type: string + +jobs: + build: + name: Build Python distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build wheel twine + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Check if package version already exists + run: | + PACKAGE_NAME=$(python setup.py --name) + PACKAGE_VERSION=${{ github.event.inputs.version }} + if twine check dist/*; then + if pip install $PACKAGE_NAME==$PACKAGE_VERSION; then + echo "Error: Version $PACKAGE_VERSION of $PACKAGE_NAME already exists on PyPI" + exit 1 + else + echo "Version $PACKAGE_VERSION of $PACKAGE_NAME does not exist on PyPI. Proceeding with upload." + fi + else + echo "Error: Twine check failed." + exit 1 + fi + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + + approve-and-publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + contents: read + id-token: write + + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: dist + path: dist/ + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + print-hash: true \ No newline at end of file diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index c6c9eb9a..f35d5fc3 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -44,7 +44,8 @@ __version__ = "8.0.0" -_version_split = __version__.split(".") +_core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0) +_version_split = _core_version.split(".") __version_info__ = tuple(int(part) for part in _version_split) _version_int_base = 1000 assert max(__version_info__) < _version_int_base diff --git a/requirements.txt b/requirements.txt index aa22e99b..4fc8ce9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ wheel async-property==0.2.2 +py-bip39-bindings==0.1.11 aiohttp~=3.10.2 backoff~=2.2.1 GitPython>=3.0.0 @@ -16,5 +17,6 @@ scalecodec==1.2.11 substrate-interface~=1.7.9 typer~=0.12 websockets>=12.0 -git+https://github.com/opentensor/btwallet.git#egg=bittensor-wallet +git+https://github.com/opentensor/btwallet.git#egg=bittensor-wallet # To be removed +# bittensor-wallet==1.0.0r # To be uncommented after wallet release bt-decode==0.2.0a0 # this will change in the future to 0.2.0 \ No newline at end of file diff --git a/setup.py b/setup.py index ceb0dbdc..f5f23114 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ def read_requirements(path): long_description_content_type="text/markdown", url="https://github.com/opentensor/btcli", author="bittensor.com", - packages=find_packages(exclude=["tests", "tests.*", "*/tests/*", "*/tests"]), + packages=find_packages(exclude=["tests", "tests.*", "*/tests/*", "*/tests"]) + ['bittensor_cli.src.bittensor.templates'], include_package_data=True, package_data={ "": ["templates/*"], @@ -82,7 +82,7 @@ def read_requirements(path): ], }, classifiers=[ - "Development Status :: 1 - Alpha", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Build Tools", "License :: OSI Approved :: MIT License", @@ -90,6 +90,7 @@ def read_requirements(path): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Artificial Intelligence",