Skip to content

Commit

Permalink
build(release): add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
eddywashere committed Mar 14, 2016
1 parent 0d5f32f commit 39fde3d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist
test/coverage
node_modules
50 changes: 50 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

set -e

BUMP_TYPE=$1
CURRENT_BRANCH="$(git symbolic-ref --short -q HEAD)"

success() {
echo -e "\033[32;1m$1"
}

error() {
echo -e "\033[31;1m$1"
}

if [ -z "$CURRENT_BRANCH" ]; then
error "Not in a branch. Stopping deploy."
exit 1
fi

if [ -z "$BUMP_TYPE" ]; then
echo "Grabbing recommended bump type..."
BUMP_TYPE="$(node_modules/.bin/conventional-recommended-bump -p angular)"
fi

if [ -z "$BUMP_TYPE" ]; then
error "Unable to set the type of version bump"
exit 1
fi

echo "==> Bumping version"
VERSION="$(npm version --no-git-tag-version $BUMP_TYPE | sed 's/v//g')"

echo "==> Updating Changelog"
node_modules/.bin/conventional-changelog -i CHANGELOG.md -o CHANGELOG.md -p angular

echo "==> Cleaning Build directory"
rm -rf ./dist

echo "==> Creating build files"
npm run build

echo "==> Committing changes"

git add --all
git commit --message "chore(release): adding $VERSION"
git tag -a $VERSION -m "release $VERSION"
git push --set-upstream origin $CURRENT_BRANCH
git push --tags
npm publish

0 comments on commit 39fde3d

Please sign in to comment.