This commit is contained in:
@@ -9,17 +9,13 @@ env:
|
||||
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
||||
GITEA_URL: "https://hub.gaomia.site"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: debian
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
apk add git curl
|
||||
apt-get update && apt-get install -y git curl go
|
||||
|
||||
- name: Download dependencies
|
||||
run: go mod download
|
||||
@@ -55,36 +51,21 @@ jobs:
|
||||
- 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_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\"}")
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
|
||||
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
|
||||
[ -f "$f" ] && curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token $GITEA_TOKEN" -F "attachment=@$f"
|
||||
done
|
||||
|
||||
echo "Release completed!"
|
||||
Reference in New Issue
Block a user