Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling][Release] Adding release script #948

Merged
merged 8 commits into from
Oct 13, 2022
89 changes: 89 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Changelog

## 3.3.4 / 2022-10-03

### What's Changed
* [hot-fix] fix indent again. add test by @camfairchild in https://github.com/opentensor/bittensor/pull/907
* Delete old gitbooks by @quac88 in https://github.com/opentensor/bittensor/pull/924
* Release/3.3.4 by @Eugene-hu in https://github.com/opentensor/bittensor/pull/927

### New Contributors
* @quac88 made their first contribution in https://github.com/opentensor/bittensor/pull/924

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.3.3...v3.3.4


## 3.3.3 / 2022-09-06

### What's Changed
* [feature] cpu register faster by @camfairchild in https://github.com/opentensor/bittensor/pull/854
* [hotfix] fix flags for multiproc register limit by @camfairchild in https://github.com/opentensor/bittensor/pull/876
* Fix/diff unpack bit shift by @camfairchild in https://github.com/opentensor/bittensor/pull/878
* [Feature] [cubit] CUDA registration solver by @camfairchild in https://github.com/opentensor/bittensor/pull/868
* Fix/move overview args to cli by @camfairchild in https://github.com/opentensor/bittensor/pull/867
* Add/address CUDA reg changes by @camfairchild in https://github.com/opentensor/bittensor/pull/879
* [Fix] --help command by @camfairchild in https://github.com/opentensor/bittensor/pull/884
* Validator hotfix min allowed weights by @Eugene-hu in https://github.com/opentensor/bittensor/pull/885
* [BIT-552] Validator improvements (nucleus permute, synergy avg) by @opentaco in https://github.com/opentensor/bittensor/pull/889
* Bit 553 bug fixes by @isabella618033 in https://github.com/opentensor/bittensor/pull/886
* add check to add ws:// if needed by @camfairchild in https://github.com/opentensor/bittensor/pull/896
* [BIT-572] Exclude lowest quantile from weight setting by @opentaco in https://github.com/opentensor/bittensor/pull/895
* [BIT-573] Improve validator epoch and responsives handling by @opentaco in https://github.com/opentensor/bittensor/pull/901
* Nobunaga Release V3.3.3 by @Eugene-hu in https://github.com/opentensor/bittensor/pull/899


**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.3.2...v3.3.3

## 3.3.2 / 2022-08-18

### SynapseType fix in dendrite
### What's Changed
* SynapseType fix in dendrite by @robertalanm in https://github.com/opentensor/bittensor/pull/874

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.3.1...v3.3.2

## 3.3.1 / 2022-08-17

### What's Changed
* [hotfix] Fix GPU reg bug. bad indent by @camfairchild in https://github.com/opentensor/bittensor/pull/883

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.3.0...v3.3.1

## 3.3.0 / 2022-08-16

### CUDA registration
This release adds the ability to complete the registration using a CUDA-capable device.
See https://github.com/opentensor/cubit/releases/tag/v1.0.5 for the required `cubit` v1.0.5 release

Also a few bug fixes for the CLI

### What's Changed
* [hotfix] fix flags for run command, fix hotkeys flag for overview, and [feature] CUDA reg by @camfairchild in https://github.com/opentensor/bittensor/pull/877

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.2.0...v3.3.0

## 3.2.0 / 2022-08-12

### Validator saving and responsive-priority weight-setting

### What's Changed
* [BIT-540] Choose responsive UIDs for setting weights in validator + validator save/load by @opentaco in https://github.com/opentensor/bittensor/pull/872

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.1.0...v3.2.0

## 3.1.0 / 2022-08-11

### Optimizing multi-processed CPU registration
This release refactors the registration code for CPU registration to improve solving performance.

### What's Changed
* [feature] cpu register faster (#854) by @camfairchild in https://github.com/opentensor/bittensor/pull/875

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v3.0.0...v3.1.0

## 3.0.0 / 2022-08-08

### Synapse update

##

141 changes: 141 additions & 0 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/bin/bash

#
# In this script you are going to find the process of releasing bittensor.
#
# This script needs:
# - that the current VERSION does not already exist
#
# This process will generate:
# - Tag in Github repo: https://github.com/opentensor/bittensor/tags
# - Release in Github: https://github.com/opentensor/bittensor/releases
# - New entry in CHANGELOG.md file
# - Python wheel in pypi: https://pypi.org/project/bittensor/
# - Docker image in dockerhub: https://hub.docker.com/r/opentensorfdn/bittensor/tags (TODO)
#

###
# Utils
###

generate_github_release_notes_post_data()
{
cat <<EOF
{
"tag_name":"$TAG_NAME",
"name":"$RELEASE_NAME",
"draft":false,
"prerelease":false,
"generate_release_notes":false
}
EOF
}

generate_github_release_post_data()
{
cat <<EOF
{
"tag_name":"$TAG_NAME",
"name":"$RELEASE_NAME",
"body":"$DESCRIPTION",
"draft":false,
"prerelease":false,
"generate_release_notes":false
}
EOF
}

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

function echo_error {
echo -e "${RED}[ERROR]${NC} $1"
}

function echo_info {
echo -e "${GREEN}[INFO]${NC} $1"
}

###
# Start of release process
###

VERSION=$(cat VERSION)
TAG_NAME=v$VERSION

# 0. Check requirements

## 0.1. Current VERSION is not already a tag

CURRENT_VERSION_EXISTS=$(git tag | grep $VERSION)

if [[ ! -z $CURRENT_VERSION_EXISTS ]]; then
echo_error "Current version '$VERSION' already exists"
exit 1
fi

# 1. Update version if applied
## Using script: ./scripts/update_version.sh

echo_info "Detected version: $VERSION"
echo_info "Tag generated: $TAG_NAME"

# 2. Tag the repository with version
function tag_repository()
{
git tag -a v$VERSION -m "Release $VERSION"
git push origin --tags
}

echo_info "Tagging repository"
tag_repository

# 3. Create Github release
function generate_github_release_notes()
{
curl --silent \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(pass github/api_bash_access_token)" \
https://api.github.com/repos/opentensor/bittensor/releases/generate-notes \
--data "$(generate_github_release_notes_post_data)"
}

function create_github_release()
{
curl --silent \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(pass github/api_bash_access_token)" \
https://api.github.com/repos/opentensor/bittensor/releases \
--data "$(generate_github_release_post_data)" > /dev/null
}

DATE=$(date +"%Y-%m-%d")
RELEASE_NAME="$VERSION / $DATE"

echo_info "Generating Github release notes"
DESCRIPTION=$(generate_github_release_notes | jq '.body' | tail -1 | sed "s/\"//g")

echo_info "Generating Github release"
create_github_release

echo_info "Adding release notes to CHANGELOG.md"
sed -i "2 i\\\n## $RELEASE_NAME" CHANGELOG.md
sed -i "4 i\\\n$DESCRIPTION\n" CHANGELOG.md

# 4. Generate python wheel
echo_info "Removing dirs: dist/ and build/"
rm -rf dist/
rm -rf build/

echo_info "Generating python wheel"
python3 setup.py sdist bdist_wheel

# 5. Upload pypi wheel
python3 -m twine upload dist/*

# 6. Creating docker image

# 7. Uploading docker image
File renamed without changes.