File tree Expand file tree Collapse file tree 3 files changed +23
-13
lines changed
Expand file tree Collapse file tree 3 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 2828 - name : Build and publish Docker image
2929 run : |
3030 VERSION=${{ github.event.inputs.version }}
31+ chmod +x docker/docker-build.sh
32+ chmod +x docker/docker-publish.sh
3133 sh docker/docker-build.sh $VERSION
32- sh docker/docker-publish.sh
34+ sh docker/docker-publish.sh $VERSION
Original file line number Diff line number Diff line change @@ -4,7 +4,13 @@ sbinDir=$(cd "$(dirname "$0")"; pwd)
44chmod +x $sbinDir /supersonic-common.sh
55source $sbinDir /supersonic-common.sh
66cd $projectDir
7- MVN_VERSION=$( mvn help:evaluate -Dexpression=project.version | grep -e ' ^[^\[]' )
7+
8+ MVN_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout | grep -v ' ^\[' | sed -n ' /^[0-9]/p' )
9+ if [ -z " $MVN_VERSION " ]; then
10+ echo " Failed to retrieve Maven project version."
11+ exit 1
12+ fi
13+ echo " Maven project version: $MVN_VERSION "
814
915cd $baseDir
1016service=$1
Original file line number Diff line number Diff line change 1- #! /bin/bash
2- # 确保脚本在出错时退出
1+ #! /usr/ bin/env bash
2+ # Exit immediately if a command exits with a non-zero status
33set -e
4- # 镜像名称
4+ VERSION=$1
5+
6+ # Image name
57IMAGE_NAME=" supersonicbi/supersonic"
68
7- # 默认标签为 latest
8- TAGS=( " latest" )
9+ # Default tag is latest
10+ TAGS=" latest"
911
10- # 如果有 Git 标签,则使用 Git 标签作为额外的镜像标签
11- if [ -n " $GITHUB_REF " ]; then
12- GIT_TAG= $( echo $GITHUB_REF | sed ' s/refs\/tags\/// ' )
13- TAGS+=( " $GIT_TAG " )
12+ # If VERSION is provided, add it to TAGS and tag the image as latest
13+ if [ -n " $VERSION " ]; then
14+ TAGS= " $TAGS $VERSION "
15+ docker tag $IMAGE_NAME : $VERSION $IMAGE_NAME :latest
1416fi
1517
16- # 推送 Docker 镜像
17- for TAG in " ${ TAGS[@]} " ; do
18+ # Push Docker images
19+ for TAG in $ TAGS; do
1820 echo " Pushing Docker image $IMAGE_NAME :$TAG "
1921 docker push $IMAGE_NAME :$TAG
2022done
You can’t perform that action at this time.
0 commit comments