Skip to content

Commit 52ae17c

Browse files
committed
infra: update release.sh to do github steps by api
1 parent 89342d3 commit 52ae17c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

release.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ echo "Make sure you prepared your PC for automative deployment"
55
echo "Release process: https://github.com/checkstyle/eclipse-cs/wiki/How-to-release"
66

77
RELEASE=$1
8+
FUTURE_RELEASE=$2
89
PREV_RELEASE=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 \
910
-t -m pom:project -v pom:version pom.xml | sed "s/-SNAPSHOT//")
11+
TOKEN_FILE=~/.m2/token-checkstyle.txt
1012

1113
echo "PREVIOUS RELEASE version:"$PREV_RELEASE
1214
echo "RELEASE version:"$RELEASE
15+
echo "FUTURE_RELEASE version:"$FUTURE_RELEASE
1316

1417
if [[ -z $RELEASE ]]; then
1518
echo "Please provide version as argument."
@@ -19,6 +22,14 @@ if [[ -z $PREV_RELEASE ]]; then
1922
echo "Problem to calculate previous release version."
2023
exit 1
2124
fi
25+
if [[ -z $FUTURE_RELEASE ]]; then
26+
echo "Problem to calculate future release version."
27+
exit 1
28+
fi
29+
if [[ ! -f $TOKEN_FILE ]]; then
30+
echo "Problem to calculate future release version."
31+
exit 1
32+
fi
2233

2334
echo "Update the plugin/project versions to the new target version."
2435
mvn tycho-versions:set-version -DnewVersion="${RELEASE}-SNAPSHOT"
@@ -72,4 +83,30 @@ echo "Create release tag on latest commit, push tag to origin"
7283
git tag $RELEASE
7384
git push origin --tags
7485

86+
echo "Get token value"
87+
TKN=$(cat $TOKEN_FILE)
88+
89+
echo "Create release based on tag"
90+
curl -i -H "Authorization: token $TKN" \
91+
-d "{ \"tag_name\": \"$RELEASE\", \
92+
\"body\": \"https://checkstyle.org/eclipse-cs/#"\!"/releasenotes/\", \
93+
\"draft\": false, \"prerelease\": false }" \
94+
-X POST https://api.github.com/repos/checkstyle/eclipse-cs/releases
95+
96+
echo "Close previous milestone"
97+
MILESTONE_ID=$(curl -s \
98+
-X GET https://api.github.com/repos/checkstyle/eclipse-cs/milestones?state=open \
99+
| jq ".[0] | .number")
100+
curl -i -H "Authorization: token $TKN" \
101+
-d "{ \"state\": \"closed\" }" \
102+
-X PATCH https://api.github.com/repos/checkstyle/eclipse-cs/milestones/$MILESTONE_ID
103+
104+
echo "Create new milestone"
105+
curl -i -H "Authorization: token $TKN" \
106+
-d "{ \"title\": \"$FUTURE_RELEASE\", \
107+
\"state\": \"open\", \
108+
\"description\": \"\" \
109+
}" \
110+
-X POST https://api.github.com/repos/checkstyle/eclipse-cs/milestones
111+
75112
echo "Release is done."

0 commit comments

Comments
 (0)