From 1fa53d0635f6a5f10bfee9a2b9325e741f1e5a23 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Wed, 18 Sep 2024 23:34:27 +0800 Subject: [PATCH] fix: release permission --- .github/workflows/build.yml | 1 + .github/workflows/release.yml | 7 ++++++- .github/workflows/release_dev.yml | 7 ++++++- Dockerfile | 5 +++-- script/build.sh | 14 +++++++------- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8aa2c21..a85fa50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,7 @@ jobs: run: | sudo BUILD_CONFIG=script/build.config.sh bash \ script/build.sh \ + --enable-micro \ --skip-init-web \ --platforms="${{ matrix.target }}" \ --more-go-cmd-args='-a -v -x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f68c0c5..cc7f4e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,12 @@ jobs: - name: Build run: | - BUILD_CONFIG=script/build.config.sh bash script/build.sh --version="v${{ steps.get_version.outputs.VERSION }}" --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v' + sudo BUILD_CONFIG=script/build.config.sh bash \ + script/build.sh \ + --enable-micro \ + --version="v${{ steps.get_version.outputs.VERSION }}" \ + --platforms="${{ matrix.target }}" \ + --more-go-cmd-args='-a -v' - name: Release uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/release_dev.yml b/.github/workflows/release_dev.yml index 3ecb7a9..1dafcbe 100644 --- a/.github/workflows/release_dev.yml +++ b/.github/workflows/release_dev.yml @@ -45,7 +45,12 @@ jobs: - name: Build run: | - BUILD_CONFIG=script/build.config.sh bash script/build.sh --version=dev --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v -x' + sudo BUILD_CONFIG=script/build.config.sh bash \ + script/build.sh \ + --enable-micro \ + --version=dev \ + --platforms="${{ matrix.target }}" \ + --more-go-cmd-args='-a -v -x' - name: Release uses: softprops/action-gh-release@v2 diff --git a/Dockerfile b/Dockerfile index 21abba1..f77dc12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,9 @@ COPY ./ ./ RUN apk add --no-cache bash curl git go g++ RUN bash script/build.sh --version=${VERSION} \ - --disable-micro --bin-name-no-suffix \ - --force-gcc='gcc -static' --force-g++='g++ -static' \ + --bin-name-no-suffix \ + --force-gcc='gcc -static' \ + --force-g++='g++ -static' \ --more-go-cmd-args='-a -v' FROM alpine:latest diff --git a/script/build.sh b/script/build.sh index b6091c2..5be63af 100755 --- a/script/build.sh +++ b/script/build.sh @@ -60,7 +60,7 @@ function printEnvHelp() { echo -e " ${COLOR_LIGHT_CYAN}BIN_NAME${COLOR_RESET} - Set the binary name (default: source directory basename)." echo -e " ${COLOR_LIGHT_CYAN}BIN_NAME_NO_SUFFIX${COLOR_RESET} - Do not append the architecture suffix to the binary name." echo -e " ${COLOR_LIGHT_CYAN}PLATFORM${COLOR_RESET} - Set the target platform(s) (default: host platform, supports: all, linux, linux/arm*, ...)." - echo -e " ${COLOR_LIGHT_CYAN}DISABLE_MICRO${COLOR_RESET} - Disable building micro variants." + echo -e " ${COLOR_LIGHT_CYAN}ENABLE_MICRO${COLOR_RESET} - Enable building micro variants." echo -e " ${COLOR_LIGHT_CYAN}CGO_ENABLED${COLOR_RESET} - Enable or disable CGO (default: ${DEFAULT_CGO_ENABLED})." echo -e " ${COLOR_LIGHT_CYAN}FORCE_CGO${COLOR_RESET} - Force the use of CGO (default: ${DEFAULT_FORCE_CGO})." echo -e " ${COLOR_LIGHT_CYAN}HOST_CC${COLOR_RESET} - Set the host C compiler (default: ${DEFAULT_CC})." @@ -94,7 +94,7 @@ function printHelp() { echo -e " ${COLOR_LIGHT_BLUE}--bin-name=${COLOR_RESET} - Specify the binary name (default: source directory basename)." echo -e " ${COLOR_LIGHT_BLUE}--bin-name-no-suffix${COLOR_RESET} - Do not append the architecture suffix to the binary name." echo -e " ${COLOR_LIGHT_BLUE}--more-go-cmd-args=''${COLOR_RESET} - Pass additional arguments to the 'go build' command." - echo -e " ${COLOR_LIGHT_BLUE}--disable-micro${COLOR_RESET} - Disable building micro architecture variants." + echo -e " ${COLOR_LIGHT_BLUE}--enable-micro${COLOR_RESET} - Enable building micro architecture variants." echo -e " ${COLOR_LIGHT_BLUE}--ldflags=''${COLOR_RESET} - Set linker flags (default: \"${DEFAULT_LDFLAGS}\")." echo -e " ${COLOR_LIGHT_BLUE}--ext-ldflags=''${COLOR_RESET} - Set external linker flags (default: \"${DEFAULT_EXT_LDFLAGS}\")." echo -e " ${COLOR_LIGHT_BLUE}-p=, --platforms=${COLOR_RESET} - Specify target platform(s) (default: host platform, supports: all, linux, linux/arm*, ...)." @@ -171,7 +171,7 @@ function fixArgs() { setDefault "PLATFORMS" "${GOHOSTPLATFORM}" setDefault "BUILD_MODE" "${DEFAULT_BUILD_MODE}" - setDefault "DISABLE_MICRO" "" + setDefault "ENABLE_MICRO" "" setDefault "FORCE_CGO" "${DEFAULT_FORCE_CGO}" setDefault "HOST_CC" "${DEFAULT_CC}" setDefault "HOST_CXX" "${DEFAULT_CXX}" @@ -794,7 +794,7 @@ function buildTarget() { buildTargetWithMicro "${goos}" "${goarch}" "" - if [ -n "${DISABLE_MICRO}" ]; then + if [ -z "${ENABLE_MICRO}" ]; then return 0 fi @@ -917,7 +917,7 @@ function buildTargetWithMicro() { [ -z "$micro" ] && micro="6" ;; "arm64") - build_env+=("GOARM=${micro}") + build_env+=("GOARM64=${micro}") [ -z "$micro" ] && micro="v8.0" ;; "amd64") @@ -1085,8 +1085,8 @@ while [[ $# -gt 0 ]]; do --more-go-cmd-args=*) addBuildArgs "${1#*=}" ;; - --disable-micro) - DISABLE_MICRO="true" + --enable-micro) + ENABLE_MICRO="true" ;; --ldflags=*) addLDFLAGS "${1#*=}"