Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(release): add auto release and keep change log
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Jul 17, 2019
1 parent ff86fd6 commit cb4d9cf
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 42 deletions.
43 changes: 23 additions & 20 deletions .github/release-template.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<%
var groupCommits = [{
<% var groupCommits = [{
name: 'feat',
show: true,
list: []
Expand All @@ -16,13 +14,19 @@ var groupCommits = [{
name: 'docs',
show: true,
list: []
}, {
name: 'test',
show: true,
list: []
}, {
name: 'other',
show: true,
list: []
}]
}
]
var all_titles = {};
var commitHref = "https://github.com/gnes-ai/gnes/commit/"
commits.forEach(function (commit) {
Expand Down Expand Up @@ -63,6 +67,13 @@ commits.forEach(function (commit) {
title: title,
commit: commit
})
} else if(type == 'test' || type == 'tests' || type == 'ci'){
groupCommits.find(item => item.name === 'test').list.push({
type: type,
scope: scope,
title: title,
commit: commit
})
} else {
groupCommits.find(item => item.name === 'other').list.push({
type: type,
Expand Down Expand Up @@ -96,36 +107,28 @@ list.forEach(function (ct) {
title = commit.title;
}
%> - <% if(typeof commitHref === 'undefined' || commitHref === '') { %>[```<%=commit.sha1.slice(0,8)%>```]<% } else { %>[[```<%=commit.sha1.slice(0,8)%>```](<%=commitHref%><%=commit.sha1%>)]<%}%> __-__ <%=title%> (<%= commit.authorName %>)
<% })}
%>

# Release Notes

<% })} %>
<%
for(var i of groupCommits){
if(i.list.length == 0) continue;
if (i.name === 'fix' && i.show) { %>
### Bug fixes
### 🐞 Bug fixes
<% } else if( i.name === 'feat' && i.show) { %>
### New Features
### 🆕 New Features
<% } else if(i.name === 'refactor' && i.show) { %>
### Code Refactoring
### 🚧 Code Refactoring
<% } else if(i.name === 'docs' && i.show) { %>
### 📗 Documentation
### Documentation
<% } else if(i.name === 'test' && i.show) { %>
### 🏁 Unit Test and CICD
<% } else if (i.name === 'other' && i.show) { %>
### Other Improvements
### 🍹 Other Improvements
<% }
i.show && listCommits(i.list, i);
Expand Down
Empty file added CHANGELOG.md
Empty file.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ GNES enables large-scale index and semantic search for text-to-text, image-to-im

<h2 align="center">Highlights</h2>

- :cloud: **Cloud-native**: GNES is *all-in-microservice*: encoder, indexer, preprocessor and router are all running statelessly and independently in their own containers. They communicate via versioned APIs and collaborate under the orchestration of Docker Swarm/Kubernetes etc. Scaling, load-balancing, automated recovering, they come off-the-shelf in GNES.
- :cloud: **Cloud-native and elastic**: GNES is *all-in-microservice*: encoder, indexer, preprocessor and router are all running in their own containers. They communicate via versioned APIs and collaborate under the orchestration of Docker Swarm/Kubernetes etc. Scaling, load-balancing, automated recovering, they come off-the-shelf in GNES.
- :hatching_chick: **Easy-to-use on every level**: How long would it take to deploy a change that involves just changing the encoder from BERT to ELMO or switching a layer in VGG? In GNES, this is just one line change in a YAML file. We abstract the encoding and indexing logic from the code to a YAML config, so that you can combine or stack encoders and indexers without even touching the codebase.
- :rocket: **State-of-the-art**: Taking advantage of fast-evolving AI/ML/NLP/CV communities, we learn from best-of-breed deep learning models and plug them into GNES, making sure you always enjoy the state-of-the-art performance.
- :rocket: **State-of-the-art performance**: Taking advantage of fast-evolving AI/ML/NLP/CV communities, we learn from best-of-breed deep learning models and plug them into GNES, making sure you always enjoy the state-of-the-art performance.
- :nut_and_bolt: **Generic and compatible**: Searching for texts, image or even short-videos? Using Python/C/Java/Go/HTTP as the client? Doesn't matter which content form you have or which language do you use, GNES can handle them all.
- :100: **Best practice**: We love to learn the best practice from the community, helping our GNES to achieve the next level of availability, resiliency, performance, and durability. If you have any ideas or suggestions, feel free to contribute.

Expand Down Expand Up @@ -174,13 +174,16 @@ TBA

<h2 align="center">Contributing</h2>

Thanks for your interest in contributing! There are many ways to get involved; start with our [contributor guidelines](#) and then check these [open issues](/issues) for specific tasks.
Thanks for your interest in contributing!

- [Contributor guidelines](./CONTRIBUTING.md)
- [Open issues](/issues)
- [Release notes](./CHANGELOG.md)

For contributors looking to get deeper into the API we suggest cloning the repository and checking out the unit tests for examples of how to call methods.

<h2 align="center">Release Notes</h2>

TBA


<h2 align="center">Citing GNES</h2>

Expand Down
57 changes: 40 additions & 17 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# Requirements
# brew install hub
# npm install -g git-release-notes

set -e

INIT_FILE='gnes/__init__.py'
Expand Down Expand Up @@ -37,9 +41,24 @@ function pub_pypi {
}

function pub_gittag {
git tag $VER -m "$(cat ./CHANGELOG.md)"
git remote add $SOURCE_ORIGIN https://hanxiao:${GITHUB_ACCESS_TOKEN}@github.com/gnes-ai/gnes.git
git tag $VER -m "$(cat ./CHANGELOG.tmp)"
# git remote add $SOURCE_ORIGIN https://hanxiao:${GITHUB_ACCESS_TOKEN}@github.com/gnes-ai/gnes.git
git push $SOURCE_ORIGIN $VER
rm ./CHANGELOG.tmp
}

function make_chore_pr {
git checkout -B "chore-bumping-version"
git add ./CHANGELOG.md
git commit -m "chore(changelog): update change log to $1"
git push $SOURCE_ORIGIN chore-bumping-version --force
hub pull-request -m "chore(changelog): update change log to $1" --no-edit -l new-release -r gnes-ai/dev-core
git checkout master
}

function make_release_note {
git-release-notes $1..HEAD .github/release-template.ejs > ./CHANGELOG.tmp
printf '\n%s\n%s\n%s\n%s\n' "# Release Note (\`$2\`)" "> Release time: $(date +'%Y-%m-%d %H:%M:%S')" "$(cat ./CHANGELOG.tmp)" "$(cat ./CHANGELOG.md)" > ./CHANGELOG.md
}

BRANCH=$(git rev-parse --abbrev-ref HEAD)
Expand All @@ -50,25 +69,29 @@ fi


#$(grep "$VER_TAG" $CLIENT_CODE | sed -n 's/^.*'\''\([^'\'']*\)'\''.*$/\1/p')
VER=$(git tag -l | sort -V |tail -n1)
printf "current version:\t\e[1;33m$VER\e[0m\n"
OLDVER=$(git tag -l | sort -V |tail -n1)
printf "current version:\t\e[1;33m$OLDVER\e[0m\n"

git-release-notes v$VER..HEAD .github/release-template.ejs > ./CHANGELOG.md

VER=$(echo $VER | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
VER=$(echo $OLDVER | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
printf "bump version to:\t\e[1;32m$VER\e[0m\n"

make_release_note $OLDVER $VER

head -n10 ./CHANGELOG.md

read -p "release this version? " -n 1 -r
#echo # (optional) move to a new line
#if [[ $REPLY =~ ^[Yy]$ ]]
#then
# write back tag to client and server code
VER_VAL=$VER_TAG"'"${VER#"v"}"'"
change_line "$VER_TAG" "$VER_VAL" $INIT_FILE
pub_pypi
pub_gittag
mv ${TMP_INIT_FILE} $INIT_FILE
#fi
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# write back tag to client and server code
VER_VAL=$VER_TAG"'"${VER#"v"}"'"
change_line "$VER_TAG" "$VER_VAL" $INIT_FILE
pub_pypi
pub_gittag
# change the version line back
mv ${TMP_INIT_FILE} $INIT_FILE
make_chore_pr $VER
fi



0 comments on commit cb4d9cf

Please sign in to comment.