-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
executable file
·42 lines (30 loc) · 1.05 KB
/
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
38
39
40
41
42
#!/usr/bin/env bash
set -e
if [[ `git status --porcelain` ]]; then
echo "There are local changes, aborting."
exit 1
fi
if [[ `git symbolic-ref --short -q HEAD` != "master" ]]; then
echo "Must be on master branch, aborting."
exit 1
fi
echo "Current version: `cat version`"
read -p "Next version: " next_version
echo "$next_version" > version
./gradlew clean build
read -p "Do you want to release version '$next_version'? " yn
case $yn in
[Yy]* ) ;;
* ) exit 1;;
esac
git add version && git commit -m "Release $next_version :rocket:"
git push origin master
json=$(printf '{"tag_name":"%s","name":"%s","body":"%s"}' "$next_version" "$next_version" "Release $next_version.")
username=`git remote get-url origin | cut -d '/' -f 1 | cut -d ':' -f 2`
token=`cat ~/$username.token`
curl --silent --show-error --fail \
--user $username:$token \
--header 'Content-Type: application/json' \
--data "$json" \
https://api.github.com/repos/$username/log4j2-json-layout/releases
./gradlew uploadArchives closeAndReleaseRepository -Prelease