diff --git a/README-development.md b/README-development.md index cb1982b..888da5e 100644 --- a/README-development.md +++ b/README-development.md @@ -1,3 +1,7 @@ +## Coding conventions + +Use tabs for indentation, however try to minimize changes and don't re-format lines that aren't part of your task. The project has a long history and when most of the code was created, there were many authors but no coding conventions. + ## Building Compiling: @@ -11,7 +15,6 @@ make test ``` It is recommended that you install Valgrind and run tests using it (as it is done in Travis CI): - ``` ./test.pl --valgrind ``` @@ -20,14 +23,11 @@ After pushing check cross-platform compilation results on commits list on GitHub ## Releasing a new version -1. Create a commit setting version to stable: - - ChangeLog: change UNRELEASED to current date - - Makefile: strip -SNAPSHOT from version number - - README: remove UNRELEASED -2. Make sure it works: `make clean test package` -3. Git-tag this version like "v2.8.5" -4. Create a commit setting version to unstable - - revert changes from step 1 and increment version -5. `git push && git push --tags` -6. On GitHub go to Code → Releases → Draft a new release - - attach .tar.bz2 file created by `make package` from step 2 +1. Make sure you have GnuPG configured in order to sign commits +2. Run `./release.sh` which will +- create a commit releasing the current version and tag it +- create a `.tar.bz2` file with the released version +- create a commit starting work on the next version +3. git-push using the instruction printed by the script +4. On GitHub go to Code → Releases → Draft a new release + - attach the `.tar.bz2` file diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..c6fa43f --- /dev/null +++ b/release.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +VERSION=$(head -1 README | perl -ne '/Version (\d+\.\d+\.\d+)/; print $1') +NEXT_VERSION=$(echo $VERSION | perl -ne '/(\d+\.\d+\.)(\d+)/; print $1,$2+1') + +echo "Last tag is $(git tag | tail -1)" +echo "Releasing $VERSION, then bumping to $NEXT_VERSION" + +git tag | grep $VERSION + +if [[ $? == 0 ]]; then + echo "Error: this version already exists." + exit 2 +fi + +set -e + +if [[ ! -z $(git status --porcelain --untracked-files=no) ]]; then + echo "Error: make sure you committed everything" + exit 3 +fi + +CHANGELOG_DATE=$(LC_TIME=en_US date '+%B, %Y') +sed -i "s/UNRELEASED/$CHANGELOG_DATE/" ChangeLog +sed -i "s/-SNAPSHOT//" Makefile +sed -i "s/ UNRELEASED//" README + +make clean test package +git commit -a -S -m "Release $VERSION" +git tag -s v$VERSION -m $VERSION HEAD + +echo -e "\n(Version $NEXT_VERSION) -- UNRELEASED" >> ChangeLog +sed -i "s/$VERSION/$NEXT_VERSION-SNAPSHOT/" Makefile +sed -i "s/$VERSION/$NEXT_VERSION UNRELEASED/" README +git diff -U1 HEAD^ +git commit -a -m "Start developing $NEXT_VERSION" + +echo -e "\nInspect commits and run\ngit push origin master v$VERSION"