This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ffbb65d [chore] Update workflow dubboctl (#724)
8ffbb65d is described below

commit 8ffbb65d97845e81272341d351a7509ae55dbdc0
Author: Jian Zhong <[email protected]>
AuthorDate: Sat May 31 16:40:33 2025 +0800

    [chore] Update workflow dubboctl (#724)
---
 .github/workflows/dubboctl-release.yaml | 53 +++++++++++++++++----------------
 Makefile                                | 20 ++++---------
 2 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/dubboctl-release.yaml 
b/.github/workflows/dubboctl-release.yaml
index 15ce0379..26a0f104 100644
--- a/.github/workflows/dubboctl-release.yaml
+++ b/.github/workflows/dubboctl-release.yaml
@@ -17,19 +17,18 @@
 # under the License.
 #
 
-name: dubboctl release
+name: dubboctl Release
 
 on:
   release:
-    types: [create, published]
+    types: [published]
 
 jobs:
   release:
+    name: Release dubboctl
     permissions:
       contents: write
-    name: Release Dubboctl
     runs-on: ubuntu-latest
-    if: startsWith(github.event.release.tag_name, 'dubboctl/')
     strategy:
       matrix:
         goos: [linux, darwin, windows]
@@ -39,42 +38,46 @@ jobs:
             goarch: 386
 
     steps:
-      - uses: actions/checkout@v4
-      - name: Set up Go 1.x
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Set up Go
         uses: actions/setup-go@v5
         with:
           go-version-file: go.mod
 
       - name: Download dependencies
-        run: |
-          go mod download
-
-      - name: Prepare build directory
-        run: |
-          mkdir -p build/
-          cp README.md build/
-          cp LICENSE build/
+        run: go mod download
 
-      - name: Build
+      - name: Build binary
         env:
           GOOS: ${{ matrix.goos }}
           GOARCH: ${{ matrix.goarch }}
+          GIT_VERSION: ${{ github.ref_name }}
         run: |
-          make build-dubboctl
-          mv bin/dubboctl build/dubboctl
-      - name: Rename on windows
+          mkdir -p build/
+          make build-dubboctl GOOS=${GOOS} GOARCH=${GOARCH} 
GIT_VERSION=${GIT_VERSION}
+          cp README.md LICENSE build/
+          mv bin/dubboctl* build/
+
+      - name: Rename on Windows
         if: matrix.goos == 'windows'
-        run: |
-          mv build/dubboctl build/dubboctl.exe
+        run: mv build/dubboctl build/dubboctl.exe
 
       - name: Create package
         id: package
         run: |
-          PACKAGE_NAME=dubboctl-${GITHUB_REF#refs/tags/dubboctl/}-${{ 
matrix.goos }}-${{ matrix.goarch }}.tar.gz
-          tar -czvf $PACKAGE_NAME -C build .
-          echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT
+          VERSION=${GITHUB_REF#refs/tags/dubboctl/}
+          FILENAME=dubboctl-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
+          if [ "${{ matrix.goos }}" = "windows" ]; then
+            zip -j ${FILENAME}.zip build/*
+            echo "name=${FILENAME}.zip" >> $GITHUB_OUTPUT
+          else
+            tar -czvf ${FILENAME}.tar.gz -C build .
+            echo "name=${FILENAME}.tar.gz" >> $GITHUB_OUTPUT
+          fi
 
-      - name: Upload asset
+      - name: Upload release asset
         uses: actions/upload-release-asset@v1
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -82,4 +85,4 @@ jobs:
           upload_url: ${{ github.event.release.upload_url }}
           asset_path: ./${{ steps.package.outputs.name }}
           asset_name: ${{ steps.package.outputs.name }}
-          asset_content_type: application/gzip
\ No newline at end of file
+          asset_content_type: application/zip
\ No newline at end of file
diff --git a/Makefile b/Makefile
index addce599..292d3522 100644
--- a/Makefile
+++ b/Makefile
@@ -15,17 +15,9 @@
 
 SHELL := /usr/bin/env bash
 
-.PHONY: help
-help: ## Display this help screen
-       @# Display top-level targets since they are the ones most developes 
will need.
-       @grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -k1 | 
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
-       @# Now show hierarchical targets in separate sections.
-       @grep -h -E '^[a-zA-Z0-9_-]+/[a-zA-Z0-9/_-]+:.*?## .*$$' 
$(MAKEFILE_LIST) | \
-               awk '{print $$1}' | \
-               awk -F/ '{print $$1}' | \
-               sort -u | \
-       while read section ; do \
-               echo; \
-               grep -h -E "^$$section/[^:]+:.*?## .*$$" $(MAKEFILE_LIST) | 
sort -k1 | \
-                       awk 'BEGIN {FS = ":.*?## "}; {printf 
"\033[36m%-30s\033[0m %s\n", $$1, $$2}' ; \
-       done
+.PHONY: build-dubboctl
+build-dubboctl:
+       mkdir -p bin
+       CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
+       -ldflags "-X 
github.com/apache/dubbo-kubernetes/pkg/version.gitTag=$(GIT_VERSION)" \
+       -o bin/dubboctl dubboctl/main.go
\ No newline at end of file

Reply via email to