-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease.sh
executable file
·37 lines (29 loc) · 968 Bytes
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Illegal number of parameters" >&2
exit 2
fi
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!
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 reset --soft HEAD~2
git commit -m"Release $VERSION: $1"
git tag -a v"$VERSION" -m "Release v$VERSION: $1"
git push --follow-tags --force
clojure -X:deploy
echo "Released $VERSION"