Compare commits
11 Commits
v0.1.9-tes
...
v0.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 1da98957c2 | |||
| bd48c305ab | |||
| 9653260567 | |||
| 6595a39abe | |||
| 5fd58e44bb | |||
| 38b957d40b | |||
| 85e710ea02 | |||
| 3d9b2d6a90 | |||
| 0427274994 | |||
| c79977496d | |||
| b8d0530118 |
@@ -9,17 +9,13 @@ env:
|
|||||||
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
||||||
GITEA_URL: "https://hub.gaomia.site"
|
GITEA_URL: "https://hub.gaomia.site"
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
run: |
|
run: |
|
||||||
apk add git curl
|
apt-get update && apt-get install -y git curl go
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
@@ -27,23 +23,15 @@ jobs:
|
|||||||
- name: Build for all platforms
|
- name: Build for all platforms
|
||||||
run: |
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
platforms="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64"
|
||||||
platforms=(
|
for p in $platforms; do
|
||||||
"linux/amd64"
|
os=$(echo "$p" | cut -d/ -f1)
|
||||||
"linux/arm64"
|
arch=$(echo "$p" | cut -d/ -f2)
|
||||||
"darwin/amd64"
|
|
||||||
"darwin/arm64"
|
|
||||||
"windows/amd64"
|
|
||||||
)
|
|
||||||
|
|
||||||
for p in "${platforms[@]}"; do
|
|
||||||
os="${p%/*}"
|
|
||||||
arch="${p#*/}"
|
|
||||||
ext=""
|
ext=""
|
||||||
[ "$os" = "windows" ] && ext=".exe"
|
if [ "$os" = "windows" ]; then
|
||||||
output="dist/hxclaw-${os}-${arch}${ext}"
|
ext=".exe"
|
||||||
GOOS=$os GOARCH=$arch go build -o "$output" ./cmd/hxclaw
|
fi
|
||||||
echo "Built: $output"
|
GOOS=$os GOARCH=$arch go build -o "dist/hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Generate checksums
|
- name: Generate checksums
|
||||||
@@ -52,39 +40,22 @@ jobs:
|
|||||||
sha256sum hxclaw-* > checksums.txt
|
sha256sum hxclaw-* > checksums.txt
|
||||||
cat checksums.txt
|
cat checksums.txt
|
||||||
|
|
||||||
- name: Create release and upload assets
|
- name: Create release
|
||||||
run: |
|
run: |
|
||||||
TAG_NAME="${GITEA_REF#refs/tags/}"
|
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"
|
echo "Creating release: $TAG_NAME"
|
||||||
|
|
||||||
RELEASE_RESPONSE=$(
|
|
||||||
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases" \
|
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{
|
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}"
|
||||||
\"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)
|
|
||||||
|
|
||||||
echo "Release ID: $RELEASE_ID"
|
|
||||||
|
|
||||||
|
- name: Upload assets
|
||||||
|
run: |
|
||||||
for f in dist/hxclaw-* dist/checksums.txt; do
|
for f in dist/hxclaw-* dist/checksums.txt; do
|
||||||
if [ -f "$f" ]; then
|
if [ -f "$f" ]; then
|
||||||
echo "Uploading: $f"
|
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/latest/assets" \
|
||||||
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
|
||||||
-F "attachment=@$f"
|
-F "attachment=@$f"
|
||||||
echo "Uploaded: $f"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Release completed!"
|
echo "Release completed!"
|
||||||
Reference in New Issue
Block a user