chore: 删除 GitHub workflow,添加 Gitea 本地编译 release workflow
Some checks failed
Release / build (push) Has been cancelled

This commit is contained in:
2026-04-23 20:21:58 +08:00
parent dd3c8a03e1
commit 1a76243f8f
3 changed files with 64 additions and 94 deletions

View File

@@ -7,55 +7,82 @@ on:
jobs:
build:
runs-on: ubuntu-latest
runs-on: local
container:
image: golang:1.26-alpine
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
GITEA_URL: "https://hub.gaomia.site"
GITEA_TOKEN: "${{ secrets.release_token }}"
steps:
- name: Checkout
- name: Checkout code
run: |
apk add git bash
rm -rf /workspace
git clone https://hub.gaomia.site/titor/hxclaw.git /workspace
apk add git curl
- name: Download dependencies
run: cd /workspace && go mod download
run: go mod download
- name: Build
- name: Build for all platforms
run: |
cd /workspace
for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
os=${p%/*}
arch=${p#*/}
mkdir -p dist
platforms=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
)
for p in "${platforms[@]}"; do
os="${p%/*}"
arch="${p#*/}"
ext=""
[ "$os" = "windows" ] && ext=".exe"
GOOS=$os GOARCH=$arch go build -o "hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
output="dist/hxclaw-${os}-${arch}${ext}"
GOOS=$os GOARCH=$arch go build -o "$output" ./cmd/hxclaw
echo "Built: $output"
done
- name: Checksums
run: cd /workspace && sha256sum hxclaw-* > checksums.txt
- name: Release
env:
GITEA_TOKEN: "${{ secrets.release_token }}"
- name: Generate checksums
run: |
cd /workspace
apk add curl jq
TAG_NAME="${GITHUB_REF#refs/tags/}"
RELEASE_BODY=$(git tag -l --format='%(contents)' "$TAG_NAME" 2>/dev/null || git log -1 --format="%s%n%n%b" "$TAG_NAME" 2>/dev/null || echo "Release $TAG_NAME")
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/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_BODY}\"}")
cd dist
sha256sum hxclaw-* > checksums.txt
cat checksums.txt
- name: Create release and upload assets
run: |
TAG_NAME="${GITEA_REF#refs/tags/}"
RELEASE_BODY=$(git log --format="%s%n%b" "$TAG_NAME" -1 2>/dev/null || echo "Release $TAG_NAME")
echo "Creating release: $TAG_NAME"
RELEASE_RESPONSE=$(
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_BODY\",
\"draft\": false,
\"prerelease\": false
}"
)
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
for f in hxclaw-* checksums.txt; do
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@$f"
done
echo "Release ID: $RELEASE_ID"
for f in dist/hxclaw-* dist/checksums.txt; do
if [ -f "$f" ]; then
echo "Uploading: $f"
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
-H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$f"
echo "Uploaded: $f"
fi
done
echo "Release completed!"

View File

@@ -1,57 +0,0 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.26-alpine
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
steps:
- name: Checkout
run: |
apk add git bash
- name: Download dependencies
run: go mod download
- name: Build
run: |
for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
os=${p%/*}
arch=${p#*/}
ext=""
[ "$os" = "windows" ] && ext=".exe"
GOOS=$os GOARCH=$arch go build -o "hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
done
- name: Checksums
run: sha256sum hxclaw-* > checksums.txt
- name: Release
env:
GITEA_TOKEN: ${{ secrets.release_token }}
run: |
apk add curl jq
TAG_NAME="${GITHUB_REF#refs/tags/}"
RELEASE_BODY=$(git tag -l --format='%(contents)' "$TAG_NAME" 2>/dev/null || git log -1 --format="%s%n%n%b" "$TAG_NAME" 2>/dev/null || echo "Release $TAG_NAME")
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/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_BODY}\"}")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
for f in hxclaw-* checksums.txt; do
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@$f"
done

View File

@@ -2,7 +2,7 @@
## 版本记录
### v0.1.0
### v0.1.0 (当前)
- [x] 流式输出功能
- [x] Markdown 渲染功能