Skip to content

Commit

Permalink
[Tooling][Release] Adding release script (#948)
Browse files Browse the repository at this point in the history
* Adding release script for release automation

* Adding usage when -h/--help requested or error ocurred
  • Loading branch information
eduardogr committed Oct 13, 2022
1 parent a26c9bc commit f8387ca
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 0 deletions.
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

##

170 changes: 170 additions & 0 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#!/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
# - An existing pass secret with the key github/api_bash_access_token
# - Check pass if you don't know it: https://www.passwordstore.org/
#
# 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
###

help(){
echo Usage:
echo \ \ $0
echo
echo This script release a bittensor version.
echo
echo This script needs:
echo \ \ - That the current VERSION does not already exist
echo \ \ - An existing pass secret with the key github/api_bash_access_token
echo \ \ \ \ - Check pass if you do not know it: https://www.passwordstore.org/
echo
echo The release process will generate:
echo \ \ - Tag in Github repo: https://github.com/opentensor/bittensor/tags
echo \ \ - Release in Github: https://github.com/opentensor/bittensor/releases
echo \ \ - New entry in CHANGELOG.md file
echo \ \ - Python wheel in pypi: https://pypi.org/project/bittensor/
echo \ \ - Docker image in dockerhub: https://hub.docker.com/r/opentensorfdn/bittensor/tags
echo
}

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
###

# if the user requests help, the usage is shown.
if [ "$1" == "--help" -o "$1" == "-h" ];then
help
exit 0
fi

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"
help
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://github.com/gitapi/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://github.com/gitapi/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.

0 comments on commit f8387ca

Please sign in to comment.