76 lines
2.4 KiB
YAML
76 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build & Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare Release Notes
|
|
id: versioning
|
|
run: |
|
|
TAG="${GITHUB_REF#refs/tags/}"
|
|
git fetch --tags --force
|
|
PREV_TAG=$(git tag -l "v*" --sort=-v:refname | grep -Fxv "$TAG" | head -n1 || true)
|
|
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
|
{
|
|
echo "### 🚀 What's Changed in ${TAG}"
|
|
echo
|
|
if [ -n "$PREV_TAG" ]; then
|
|
git log "${PREV_TAG}..${TAG}" --pretty=format:"- %s (%h by @kyaring)"
|
|
else
|
|
git log -n 10 --pretty=format:"- %s (%h by @kyaring)"
|
|
fi
|
|
echo
|
|
echo
|
|
if [ -n "$PREV_TAG" ]; then
|
|
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG}"
|
|
fi
|
|
} > release_notes.md
|
|
cat release_notes.md
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Build Hub & Agent
|
|
run: |
|
|
mkdir -p dist
|
|
# Linux AMD64
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o dist/vps-commander-hub-linux-amd64 ./cmd/hub
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o dist/vps-commander-agent-linux-amd64 ./cmd/agent
|
|
|
|
# Linux ARM64
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o dist/vps-commander-hub-linux-arm64 ./cmd/hub
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o dist/vps-commander-agent-linux-arm64 ./cmd/agent
|
|
|
|
# MCP stdio(与 Gitea 本地发布保持一致)
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o dist/vps-commander-mcp-stdio-linux-amd64 ./cmd/mcp-stdio
|
|
|
|
# Checksums
|
|
cd dist
|
|
sha256sum * > checksums.txt
|
|
cd ..
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.versioning.outputs.tag }}
|
|
name: Release ${{ steps.versioning.outputs.tag }}
|
|
body_path: release_notes.md
|
|
files: |
|
|
dist/*
|