diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 1823ab8..e345303 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -5,67 +5,27 @@ on: tags: - 'v*' -env: - GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct" - GITEA_URL: "https://hub.gaomia.site" - jobs: build: - runs-on: debian-slim + runs-on: ubuntu steps: - - name: Checkout code - run: | + - run: | apt-get update && apt-get install -y git curl go - - - name: Download dependencies - run: go mod download - - - name: Build for all platforms - run: | + go mod download mkdir -p dist - - platforms=( - "linux/amd64" - "linux/arm64" - "darwin/amd64" - "darwin/arm64" - "windows/amd64" - ) - - for p in "${platforms[@]}"; do + for p in linux/amd64 linux/arm64 windows/amd64; do os="${p%/*}" arch="${p#*/}" ext="" [ "$os" = "windows" ] && ext=".exe" - output="dist/hxclaw-${os}-${arch}${ext}" - GOOS=$os GOARCH=$arch go build -o "$output" ./cmd/hxclaw - echo "Built: $output" + GOOS=$os GOARCH=$arch go build -o "dist/hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw done - - - name: Generate checksums - run: | + - run: | cd dist sha256sum hxclaw-* > checksums.txt - cat checksums.txt - - - name: Create release and upload assets - run: | + - 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" \ + 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 - [ -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 + -d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}" \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 1ec464a..5ed75e2 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -9,5 +9,4 @@ jobs: test: runs-on: ubuntu steps: - - run: echo "Hello Gitea Actions!" - - run: uname -a \ No newline at end of file + - run: echo "Hello" \ No newline at end of file