This commit is contained in:
@@ -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: debian
|
||||||
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
|
||||||
@@ -55,36 +51,21 @@ jobs:
|
|||||||
- name: Create release and upload assets
|
- name: Create release and upload assets
|
||||||
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")
|
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=$(
|
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 $GITEA_TOKEN" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"$RELEASE_BODY\"}")
|
||||||
-d "{
|
|
||||||
\"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)
|
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
|
||||||
echo "Release ID: $RELEASE_ID"
|
echo "Release ID: $RELEASE_ID"
|
||||||
|
|
||||||
for f in dist/hxclaw-* dist/checksums.txt; do
|
for f in dist/hxclaw-* dist/checksums.txt; do
|
||||||
if [ -f "$f" ]; then
|
[ -f "$f" ] && curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/${RELEASE_ID}/assets" \
|
||||||
echo "Uploading: $f"
|
-H "Authorization: token $GITEA_TOKEN" -F "attachment=@$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
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Release completed!"
|
echo "Release completed!"
|
||||||
13
.gitea/workflows/test.yml
Normal file
13
.gitea/workflows/test.yml
Normal file
@@ -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!"
|
||||||
Reference in New Issue
Block a user