chore: 删除 GitHub workflow,添加 Gitea 本地编译 release workflow
Some checks failed
Release / build (push) Has been cancelled
Some checks failed
Release / build (push) Has been cancelled
This commit is contained in:
@@ -7,55 +7,82 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: local
|
||||||
container:
|
container:
|
||||||
image: golang:1.26-alpine
|
image: golang:1.26-alpine
|
||||||
env:
|
env:
|
||||||
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
||||||
|
GITEA_URL: "https://hub.gaomia.site"
|
||||||
|
GITEA_TOKEN: "${{ secrets.release_token }}"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout code
|
||||||
run: |
|
run: |
|
||||||
apk add git bash
|
apk add git curl
|
||||||
rm -rf /workspace
|
|
||||||
git clone https://hub.gaomia.site/titor/hxclaw.git /workspace
|
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: cd /workspace && go mod download
|
run: go mod download
|
||||||
|
|
||||||
- name: Build
|
- name: Build for all platforms
|
||||||
run: |
|
run: |
|
||||||
cd /workspace
|
mkdir -p dist
|
||||||
for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
|
|
||||||
os=${p%/*}
|
platforms=(
|
||||||
arch=${p#*/}
|
"linux/amd64"
|
||||||
|
"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"
|
||||||
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
|
done
|
||||||
|
|
||||||
- name: Checksums
|
- name: Generate checksums
|
||||||
run: cd /workspace && sha256sum hxclaw-* > checksums.txt
|
|
||||||
|
|
||||||
- name: Release
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: "${{ secrets.release_token }}"
|
|
||||||
run: |
|
run: |
|
||||||
cd /workspace
|
cd dist
|
||||||
apk add curl jq
|
sha256sum hxclaw-* > checksums.txt
|
||||||
|
cat checksums.txt
|
||||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
|
||||||
|
- name: Create release and upload assets
|
||||||
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")
|
run: |
|
||||||
|
TAG_NAME="${GITEA_REF#refs/tags/}"
|
||||||
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases" \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
RELEASE_BODY=$(git log --format="%s%n%b" "$TAG_NAME" -1 2>/dev/null || echo "Release $TAG_NAME")
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${RELEASE_BODY}\"}")
|
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)
|
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
|
||||||
for f in hxclaw-* checksums.txt; do
|
echo "Release ID: $RELEASE_ID"
|
||||||
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
|
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
for f in dist/hxclaw-* dist/checksums.txt; do
|
||||||
-F "attachment=@$f"
|
if [ -f "$f" ]; then
|
||||||
done
|
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!"
|
||||||
57
.github/workflows/release.yml
vendored
57
.github/workflows/release.yml
vendored
@@ -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
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 版本记录
|
## 版本记录
|
||||||
|
|
||||||
### v0.1.0
|
### v0.1.0 (当前)
|
||||||
|
|
||||||
- [x] 流式输出功能
|
- [x] 流式输出功能
|
||||||
- [x] Markdown 渲染功能
|
- [x] Markdown 渲染功能
|
||||||
|
|||||||
Reference in New Issue
Block a user