Skip to content

Commit

Permalink
Adds release pre-reqs (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheem-opentensor authored Sep 25, 2024
1 parent 6827ec1 commit c698c5f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/*"],
Expand All @@ -82,14 +82,15 @@ 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",
"Programming Language :: Python :: 3 :: Only",
"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",
Expand Down

0 comments on commit c698c5f

Please sign in to comment.