This commit is contained in:
@@ -5,27 +5,57 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
|
||||||
|
GITEA_URL: "https://hub.gaomia.site"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
apt-get update && apt-get install -y git curl go
|
apt-get update && apt-get install -y git curl go
|
||||||
go mod download
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
|
||||||
|
- name: Build for all platforms
|
||||||
|
run: |
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
for p in linux/amd64 linux/arm64 windows/amd64; do
|
platforms="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64"
|
||||||
os="${p%/*}"
|
for p in $platforms; do
|
||||||
arch="${p#*/}"
|
os=$(echo "$p" | cut -d/ -f1)
|
||||||
|
arch=$(echo "$p" | cut -d/ -f2)
|
||||||
ext=""
|
ext=""
|
||||||
[ "$os" = "windows" ] && ext=".exe"
|
if [ "$os" = "windows" ]; then
|
||||||
|
ext=".exe"
|
||||||
|
fi
|
||||||
GOOS=$os GOARCH=$arch go build -o "dist/hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
|
GOOS=$os GOARCH=$arch go build -o "dist/hxclaw-${os}-${arch}${ext}" ./cmd/hxclaw
|
||||||
done
|
done
|
||||||
- run: |
|
|
||||||
|
- name: Generate checksums
|
||||||
|
run: |
|
||||||
cd dist
|
cd dist
|
||||||
sha256sum hxclaw-* > checksums.txt
|
sha256sum hxclaw-* > checksums.txt
|
||||||
- run: |
|
cat checksums.txt
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
run: |
|
||||||
TAG_NAME="${GITEA_REF#refs/tags/}"
|
TAG_NAME="${GITEA_REF#refs/tags/}"
|
||||||
|
echo "Creating release: $TAG_NAME"
|
||||||
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 $TAG_NAME\"}"
|
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\",\"body\":\"Release $TAG_NAME\"}"
|
||||||
|
|
||||||
|
- name: Upload assets
|
||||||
|
run: |
|
||||||
|
for f in dist/hxclaw-* dist/checksums.txt; do
|
||||||
|
if [ -f "$f" ]; then
|
||||||
|
curl -s -X POST "$GITEA_URL/api/v1/repos/titor/hxclaw/releases/latest/assets" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-F "attachment=@$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Release completed!"
|
||||||
@@ -9,4 +9,8 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
steps:
|
steps:
|
||||||
- run: echo "Hello"
|
- name: Echo hello
|
||||||
|
run: echo "Hello Gitea Actions!"
|
||||||
|
|
||||||
|
- name: Show system info
|
||||||
|
run: uname -a
|
||||||
Reference in New Issue
Block a user