-
Notifications
You must be signed in to change notification settings - Fork 123
/
release
executable file
·25 lines (17 loc) · 1.02 KB
/
release
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
#! /bin/bash
# After `mvn clean package -am -pl build`, this script can help you to release `easeagent-dep.jar` to github.
RELEASE_ID=41698268
LIST_RELEASE_URL="https://api.github.com/repos/megaease/easeagent/releases"
RELEASE_URL="https://api.github.com/repos/megaease/easeagent/releases/${RELEASE_ID}"
UPLOAD_URL="https://uploads.github.com/repos/megaease/easeagent/releases/${RELEASE_ID}/assets?name=easeagent.jar"
TOKEN=""
AUTH_HEAD="Authorization: token $TOKEN"
LIB_PATH="build/target/easeagent-dep.jar"
ASSET_URL=`curl -X GET -H "$AUTH_HEAD" "$RELEASE_URL" | jq --raw-output '.assets[0].url'`
echo "Delete last asset is $ASSET_URL"
curl -X DELETE -H "$AUTH_HEAD" "$ASSET_URL"
MD5=`md5 -q $LIB_PATH`
echo "Update easeagent hash: $MD5"
curl -X PATCH -H "$AUTH_HEAD" -H "Content-Type: application/json" -d "{\"body\":\"MD5(easeagent.jar) = \`$MD5\`\"}" "$RELEASE_URL" > /dev/null
echo "Upload easeagent.jar"
curl -X POST -H "$AUTH_HEAD" -H "Content-Type: application/java-archive" --progress-bar --data-binary @$LIB_PATH "$UPLOAD_URL"