15 Commits

Author SHA1 Message Date
c7767edd4f fix: 使用阿里云 apk 镜像源 v3.20 2026-04-23 21:34:28 +08:00
cc9b2a5c76 fix: 添加阿里云镜像源 2026-04-23 21:19:49 +08:00
d27771e020 fix: 按照示例修改 workflow 格式
Some checks failed
Release / build (push) Has been cancelled
2026-04-23 21:15:10 +08:00
efa10cb0e6 fix: 简化 workflow 2026-04-23 21:12:54 +08:00
1da98957c2 fix: 修正 secret 名称为 RELEASE_TOKEN
Some checks failed
Release / build (push) Has been cancelled
2026-04-23 21:03:54 +08:00
bd48c305ab chore: 删除测试 workflow
Some checks failed
Release / build (push) Has been cancelled
2026-04-23 20:52:50 +08:00
9653260567 fix: test 使用完整版
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:52:30 +08:00
6595a39abe fix: 恢复完整 workflow 格式
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:51:50 +08:00
5fd58e44bb fix: 简化 workflow 格式
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:50:48 +08:00
38b957d40b test: 使用 ubuntu 标签
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:49:11 +08:00
85e710ea02 test: 直接使用 debian:latest
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:47:35 +08:00
3d9b2d6a90 test: 使用 debian:latest 镜像
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:46:36 +08:00
0427274994 test: 使用 host label
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:45:09 +08:00
c79977496d test: 使用 debian-slim runner
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:41:13 +08:00
b8d0530118 test: 添加测试 workflow
Some checks failed
Test / test (push) Has been cancelled
2026-04-23 20:39:27 +08:00

View File

@@ -5,86 +5,61 @@ on:
tags: tags:
- 'v*' - 'v*'
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
GITEA_URL: "https://hub.gaomia.site"
defaults:
run:
shell: bash
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: golang:1.26-alpine
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
steps: steps:
- name: Checkout code - name: Checkout
run: | run: |
apk add git curl # 使用阿里云 apk 镜像源
echo -e 'https://mirrors.aliyun.com/alpine/v3.20/main/\nhttps://mirrors.aliyun.com/alpine/v3.20/community/' > /etc/apk/repositories
apk add git bash
git clone https://hub.gaomia.site/titor/HxClaw.git /workspace/hxclaw
cp -r /workspace/hxclaw/* /workspace/hxclaw/
cp -r /workspace/hxclaw/.* /workspace/hxclaw/ 2>/dev/null || true
- name: Download dependencies - name: Download dependencies
run: go mod download run: go mod download
- name: Build for all platforms - name: Build
run: | run: |
mkdir -p dist cd /workspace/hxclaw
for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
platforms=( os=${p%/*}
"linux/amd64" arch=${p#*/}
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
)
for p in "${platforms[@]}"; do
os="${p%/*}"
arch="${p#*/}"
ext="" ext=""
[ "$os" = "windows" ] && ext=".exe" [ "$os" = "windows" ] && ext=".exe"
output="dist/hxclaw-${os}-${arch}${ext}" GOOS=$os GOARCH=$arch go build -o "hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
GOOS=$os GOARCH=$arch go build -o "$output" ./cmd/hxclaw
echo "Built: $output"
done done
- name: Generate checksums - name: Checksums
run: sha256sum hxclaw-* > checksums.txt
- name: Release
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: | run: |
cd dist # 使用阿里云 apk 镜像源
sha256sum hxclaw-* > checksums.txt echo -e 'https://mirrors.aliyun.com/alpine/v3.20/main/\nhttps://mirrors.aliyun.com/alpine/v3.20/community/' > /etc/apk/repositories
cat checksums.txt apk add curl jq
- name: Create release and upload assets TAG_NAME="${GITHUB_REF#refs/tags/}"
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") 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")
echo "Creating release: $TAG_NAME" RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
RELEASE_RESPONSE=$(
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{ -d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${RELEASE_BODY}\"}")
\"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) RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo "Release ID: $RELEASE_ID" 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" \
for f in dist/hxclaw-* dist/checksums.txt; do -H "Authorization: token ${GITEA_TOKEN}" \
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" -F "attachment=@$f"
echo "Uploaded: $f"
fi
done done
echo "Release completed!"