From 6595a39abe4b40aed55a4de9b8da9ceb81c9320d Mon Sep 17 00:00:00 2001 From: "Z.To" Date: Thu, 23 Apr 2026 20:51:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8D=E5=AE=8C=E6=95=B4=20w?= =?UTF-8?q?orkflow=20=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 48 +++++++++++++++++++++++++++++------- .gitea/workflows/test.yml | 6 ++++- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index e345303..3ca7fe9 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,27 +5,57 @@ on: tags: - 'v*' +env: + GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct" + GITEA_URL: "https://hub.gaomia.site" + jobs: build: runs-on: ubuntu steps: - - run: | + - name: Checkout code + run: | apt-get update && apt-get install -y git curl go - go mod download + + - name: Download dependencies + run: go mod download + + - name: Build for all platforms + run: | mkdir -p dist - for p in linux/amd64 linux/arm64 windows/amd64; do - os="${p%/*}" - arch="${p#*/}" + platforms="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64" + for p in $platforms; do + os=$(echo "$p" | cut -d/ -f1) + arch=$(echo "$p" | cut -d/ -f2) ext="" - [ "$os" = "windows" ] && ext=".exe" + if [ "$os" = "windows" ]; then + ext=".exe" + fi GOOS=$os GOARCH=$arch go build -o "dist/hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw done - - run: | + + - name: Generate checksums + run: | cd dist sha256sum hxclaw-* > checksums.txt - - run: | + cat checksums.txt + + - name: Create release + run: | TAG_NAME="${GITEA_REF#refs/tags/}" + echo "Creating release: $TAG_NAME" curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases" \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}" \ No newline at end of file + -d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}" + + - name: Upload assets + run: | + for f in dist/hxclaw-* dist/checksums.txt; do + if [ -f "$f" ]; then + curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/latest/assets" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@$f" + fi + done + echo "Release completed!" \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 5ed75e2..baae054 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -9,4 +9,8 @@ jobs: test: runs-on: ubuntu steps: - - run: echo "Hello" \ No newline at end of file + - name: Echo hello + run: echo "Hello Gitea Actions!" + + - name: Show system info + run: uname -a \ No newline at end of file