Files
HxClaw/.gitea/workflows/release.yml
2026-04-23 21:12:54 +08:00

44 lines
1.5 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu
steps:
- name: Checkout code
run: apt-get update && apt-get install -y git curl go
- name: Download dependencies
run: go mod download
- name: Build
run: |
mkdir -p dist
GOOS=linux GOARCH=amd64 go build -o dist/hxclaw-linux-amd64 ./cmd/hxclaw
GOOS=linux GOARCH=arm64 go build -o dist/hxclaw-linux-arm64 ./cmd/hxclaw
GOOS=darwin GOARCH=amd64 go build -o dist/hxclaw-darwin-amd64 ./cmd/hxclaw
GOOS=darwin GOARCH=arm64 go build -o dist/hxclaw-darwin-arm64 ./cmd/hxclaw
GOOS=windows GOARCH=amd64 go build -o dist/hxclaw-windows-amd64.exe ./cmd/hxclaw
- name: Checksum
run: cd dist && sha256sum hxclaw-* > checksums.txt
- name: Create release
run: |
TAG_NAME="${GITEA_REF#refs/tags/}"
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}"
- name: Upload
run: |
for f in dist/hxclaw-* dist/checksums.txt; do
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/hxclaw/releases/latest/assets" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-F "attachment=@$f"
done