-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease
More file actions
executable file
·58 lines (45 loc) · 1.36 KB
/
release
File metadata and controls
executable file
·58 lines (45 loc) · 1.36 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash -e
EXPECTED_BRANCH=master
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" != "$EXPECTED_BRANCH" ]]; then
echo "FAIL: Not on master (on $BRANCH)"
exit -1
fi
git diff-index --quiet --cached HEAD -- || {
echo "FAIL: Uncommitted changes at head"
exit -1
}
git diff-index --quiet HEAD -- || {
echo "FAIL: Uncommitted modifications at head"
exit -1
}
LAST_TAG=$(git describe --abbrev=0 --tags)
VERSION=$(./gradlew --quiet printVersion)
if [[ "$LAST_TAG" == "$VERSION" ]]; then
echo "FAIL: Last tag was $LAST_TAG and $VERSION are the same. Update build.gradle."
exit -1
fi
head HISTORY.md
read -p "Release $VERSION with HISTORY.md (above) after $LAST_TAG (y/n)? " CONT
[[ "$CONT" = "y" ]] || exit -1
sed -i "s@\(io.gladed:watchable:\|download.svg?version=\|watchable/watchable/\)[0-9\.]\+@\1$VERSION@g" README.md
echo "Building"
./gradlew clean detekt check dokkaHtml bintrayUpload
echo "Pushing to git"
git add README.md
git commit -m "$VERSION" || true # Maybe no change
git tag $VERSION
git push --tags
git push
echo "Releasing docs..."
mv build/dokka/html $VERSION
git checkout gh-pages
git pull
rm latest
ln -s $VERSION latest
echo "* [$VERSION]($VERSION/index.md)" >>index.md
git add latest index.md $VERSION
git commit -m "$VERSION"
git push
git checkout master
echo "Now visit https://bintray.com/gladed/watchable/watchable to publish"