From b8d0530118c82563fdfbadee2c9095d959e0a85d Mon Sep 17 00:00:00 2001 From: "Z.To" Date: Thu, 23 Apr 2026 20:39:27 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=20?= =?UTF-8?q?workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 35 ++++++++--------------------------- .gitea/workflows/test.yml | 13 +++++++++++++ 2 files changed, 21 insertions(+), 27 deletions(-) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index bdca853..f49f2ed 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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!" \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..5cc0192 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,13 @@ +name: Test + +on: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Hello Gitea Actions!" + - run: echo "Runner is working!" \ No newline at end of file