Skip to content

Commit

Permalink
Add release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
eproxus committed Sep 11, 2018
1 parent 067c1bf commit aadb66b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
user=grisp
project=grisp_tools
unreleased=false
exclude-labels=duplicate,invalid,wontfix,question,help wanted,unreleased
59 changes: 59 additions & 0 deletions .scripts/cut.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -e # Abort on first failure, so we don't mess something up

check_path() {
if ! [ -x "$(command -v "$1")" ]; then
echo >&2 "error: $1 not available on path"
if [ -n "$2" ]; then
echo "($2)"
fi
exit 1
fi
}

check_path git
check_path sed
check_path rebar3 "http://www.rebar3.org"
check_path github_changelog_generator "https://github.com/github-changelog-generator/github-changelog-generator"
check_path chandler "https://github.com/mattbrictson/chandler"

if [ -z "$1" ]; then
# Missing tag name
echo "usage: cut <version>" >&2
exit 129
fi
if [ ! -z "$(git status --short)" ]; then
# Sanity check
echo "fatal: dirty repository" >&2
exit 128
fi

VSN="$1"

# Update version
sed -i "" -e "s/{vsn, .*}/{vsn, \"$VSN\"}/g" src/*.app.src
git add src/*.app.src
if [ -f doc/overview.edoc ]; then
sed -i "" -e "s/@version .*/@version $VSN/g" doc/overview.edoc
git add doc/overview.edoc
fi

# Commit, tag and push
git commit -m "Version $VSN"
git tag -s "$VSN" -m "Version $VSN"
git push && git push --tags

# Clean and publish package and docs
rm -rf ebin
rm -rf src/**/*.beam
rm -rf test/**/*.beam
rebar3 hex publish
rebar3 hex docs

# Generate and push changelog
github_changelog_generator
git add CHANGELOG.md
git commit -m "Update changelog for version $VSN"
git push
chandler push "$VSN"

0 comments on commit aadb66b

Please sign in to comment.