diff --git a/.github/workflows/release_docker.yml b/.github/workflows/release_docker.yml index 095fb291..c4307920 100644 --- a/.github/workflows/release_docker.yml +++ b/.github/workflows/release_docker.yml @@ -40,7 +40,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - build-args: | + build-args: VERSION="v${{ steps.get_version.outputs.VERSION }}" push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/build.sh b/build.sh index 02fae511..c4cf3723 100755 --- a/build.sh +++ b/build.sh @@ -47,7 +47,7 @@ function ParseArgs() { exit 0 ;; v) - VERSION="$OPTARG" + VERSION="$(echo "$OPTARG" | sed 's/ //g')" ;; w) WEB_VERSION="$OPTARG" @@ -99,22 +99,17 @@ function GetLatestWebVersion() { # Comply with golang version rules function CheckVersionFormat() { - if [ "$1" == "dev" ]; then - return 0 - fi - if [ "$(echo "$1" | grep -oE "^v?[0-9]+\.[0-9]+\.[0-9]+$")" ]; then + if [ "$1" == "dev" ] || [ "$(echo "$1" | grep -oE "^v?[0-9]+\.[0-9]+\.[0-9]+$")" ]; then return 0 + else + echo "version format error: $1" + exit 1 fi - return 1 } function FixArgs() { CheckAllPlatform CheckVersionFormat "$VERSION" - if [ $? -ne 0 ]; then - echo "version format error" - exit 1 - fi if [ ! "$WEB_VERSION" ]; then if [ "$VERSION" == "dev" ]; then WEB_VERSION="dev"