aboutsummaryrefslogtreecommitdiff
path: root/release.sh
diff options
context:
space:
mode:
Diffstat (limited to 'release.sh')
-rwxr-xr-xrelease.sh24
1 files changed, 19 insertions, 5 deletions
diff --git a/release.sh b/release.sh
index dec59a2..cf0f09f 100755
--- a/release.sh
+++ b/release.sh
@@ -2,17 +2,31 @@
set -ex
+git update-index --refresh
+git diff-index --quiet HEAD --
+
clojure -Spom
clojure -M:test
clojure -M:jar
clojure -X:release ivarref.pom-patch/clojars-repo-only!
-VERSION=$(clojure -X:release ivarref.pom-patch/set-patch-version! :patch :commit-count+1)
-git add pom.xml
+LAST_TAG="$(git rev-list --tags --no-walk --max-count=1)"
+COMMITS_SINCE_LAST_TAG="$(git rev-list "$LAST_TAG"..HEAD --count)"
+echo "Squashing $COMMITS_SINCE_LAST_TAG commits ..."
+git reset --soft HEAD~"$COMMITS_SINCE_LAST_TAG"
+MSG="$(git log --format=%B --reverse HEAD..HEAD@{1})"
+git commit -m"$MSG"
+
+VERSION="$(clojure -X:release ivarref.pom-patch/set-patch-version! :patch :commit-count)"
+echo "Releasing $VERSION"
+sed -i "s/HEAD/v$VERSION/g" ./README.md
+git add pom.xml README.md
git commit -m "Release $VERSION"
-git tag -a v$VERSION -m "Release v$VERSION"
-git push --follow-tags
+git reset --soft HEAD~2
+git commit -m"Release $VERSION\n$MSG"
-clojure -X:deploy
+git tag -a v"$VERSION" -m "Release v$VERSION\n$MSG"
+git push --follow-tags --force
+clojure -X:deploy
echo "Released $VERSION"