Skip to content

Commit 87569da

Browse files
committed
[Feature] update release-image.sh to use github release
Signed-off-by: Kent Huang <kentwelcome@gmail.com>
1 parent 38b896d commit 87569da

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

release-image.sh

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
#!/bin/bash
2-
TAG=$(cat VERSION)
3-
docker build . -t infuseai/primehub-usage:$TAG
4-
docker push infuseai/primehub-usage:$TAG
2+
VERSION=$(cat VERSION)
3+
DRY_RUN=false
4+
5+
info() {
6+
echo -e "\033[0;32m$1\033[0m"
7+
}
8+
9+
warn() {
10+
echo -e "\033[0;93m$1\033[0m"
11+
}
12+
13+
error() {
14+
echo -e "\033[0;91m$1\033[0m" >&2
15+
}
16+
17+
if ! command -v curl > /dev/null; then
18+
error "[Fail] Not install curl"
19+
exit 1
20+
fi
21+
22+
if [ "${1:-}" == "--dry-run" ]; then
23+
warn "[Dry run mode]"
24+
DRY_RUN=true
25+
fi
26+
27+
tag="$VERSION"
28+
name="primehub-usage $VERSION"
29+
info "[Release] Primehub-usage with version $VERSION"
30+
echo " name: $name"
31+
echo " tag: $tag"
32+
33+
if [ "$DRY_RUN" == false ]; then
34+
curl \
35+
-X POST \
36+
-H "Accept: application/vnd.github.v3+json" \
37+
https://api.github.com/repos/infuseai/primehub-usage/releases \
38+
-d "{\"tag_name\":\"$tag\", \"name\":\"$name\"}"
39+
fi

0 commit comments

Comments
 (0)