#!/bin/bash

VERSION=$(cat project.clj | egrep -o -m 1 '[0-9].[0-9].[0-9].*')

echo "VERSION: $VERSION"

if [[ $VERSION == *"SNAPSHOT"* ]]; then
    echo "Snapshot version"
    exit 0;
fi


./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s
git add CHANGELOG.md
git commit -q -m "chore(release): Version ${VERSION} :tada: [skip ci]

$(./node_modules/.bin/conventional-changelog -p angular)
"

git push

git tag ${VERSION}

git push --tags
