Files
MuyueWorkspace/.gitea/workflows/ci-main.yml
Augustin 04b0fff791
All checks were successful
Beta Release / beta (push) Successful in 44s
refactor(api): split monolithic handlers.go into focused modules
Break down the 627-line handlers.go into specialized modules:
- handlers_chat.go: chat and streaming endpoints
- handlers_config.go: configuration endpoints
- handlers_common.go: shared utilities
- handlers_info.go: info and status endpoints
- handlers_terminal.go: terminal/shell endpoints
- handlers_tools.go: tool-related endpoints

Also includes config improvements, orchestrator enhancements, and
web component updates.

💘 Generated with Crush

Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
2026-04-22 18:34:14 +02:00

220 lines
8.5 KiB
YAML

name: Stable Release
on:
push:
branches: [main]
jobs:
stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
/root/go/pkg/mod
/home/runner/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache Node modules
uses: actions/cache@v4
with:
path: web/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('web/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Download dependencies
run: go mod download
- name: Build frontend
run: |
cd web
npm ci
npm run build
- name: Vet
run: go vet ./...
- name: Test
run: go test ./... -v -race -timeout 60s
- name: Determine version
id: version
run: |
BASE_VERSION=$(grep 'Version =' internal/version/version.go | cut -d'"' -f2)
VERSION="v${BASE_VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "base=${BASE_VERSION}" >> $GITHUB_OUTPUT
echo "Building stable release: ${VERSION}"
- name: Build (all platforms)
run: |
mkdir -p dist
LDFLAGS="-s -w"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -o dist/muyue-linux-amd64 ./cmd/muyue/
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$LDFLAGS" -o dist/muyue-linux-arm64 ./cmd/muyue/
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -o dist/muyue-darwin-amd64 ./cmd/muyue/
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$LDFLAGS" -o dist/muyue-darwin-arm64 ./cmd/muyue/
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -o dist/muyue-windows-amd64.exe ./cmd/muyue/
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags="$LDFLAGS" -o dist/muyue-windows-arm64.exe ./cmd/muyue/
- name: Package archives
run: |
cd dist
sha256sum * > checksums.txt
tar czf muyue-linux-amd64.tar.gz muyue-linux-amd64
tar czf muyue-linux-arm64.tar.gz muyue-linux-arm64
tar czf muyue-darwin-amd64.tar.gz muyue-darwin-amd64
tar czf muyue-darwin-arm64.tar.gz muyue-darwin-arm64
zip muyue-windows-amd64.zip muyue-windows-amd64.exe
zip muyue-windows-arm64.zip muyue-windows-arm64.exe
rm -f muyue-linux-amd64 muyue-linux-arm64 muyue-darwin-amd64 muyue-darwin-arm64 muyue-windows-amd64.exe muyue-windows-arm64.exe
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -v '-' | head -1 || echo "")
if [ -n "$PREV_TAG" ]; then
RANGE="${PREV_TAG}..HEAD"
echo "range=${RANGE}" >> $GITHUB_OUTPUT
else
RANGE="HEAD~30..HEAD"
echo "range=${RANGE}" >> $GITHUB_OUTPUT
fi
VERSION=${{ steps.version.outputs.version }}
DL_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${VERSION}"
{
echo "## ${VERSION}"
echo ""
echo "### Changes since ${PREV_TAG:-start}"
echo ""
git log ${RANGE} --pretty=format:"- %s (%h)" --no-merges
echo ""
echo ""
echo "### Downloads"
echo ""
echo "| Platform | File |"
echo "|----------|------|"
echo "| Linux x86_64 | [muyue-linux-amd64.tar.gz](${DL_URL}/muyue-linux-amd64.tar.gz) |"
echo "| Linux ARM64 | [muyue-linux-arm64.tar.gz](${DL_URL}/muyue-linux-arm64.tar.gz) |"
echo "| macOS Intel | [muyue-darwin-amd64.tar.gz](${DL_URL}/muyue-darwin-amd64.tar.gz) |"
echo "| macOS Apple Silicon | [muyue-darwin-arm64.tar.gz](${DL_URL}/muyue-darwin-arm64.tar.gz) |"
echo "| Windows x86_64 | [muyue-windows-amd64.zip](${DL_URL}/muyue-windows-amd64.zip) |"
echo "| Windows ARM64 | [muyue-windows-arm64.zip](${DL_URL}/muyue-windows-arm64.zip) |"
echo ""
echo "The binary includes both CLI and Desktop modes."
echo "Run \`muyue\` for TUI, \`muyue desktop\` for web UI."
echo ""
echo "### Install"
echo ""
echo "**Linux (x86_64)**"
echo "\`\`\`bash"
echo "curl -sL ${DL_URL}/muyue-linux-amd64.tar.gz | tar xz"
echo "chmod +x muyue-linux-amd64"
echo "sudo mv muyue-linux-amd64 /usr/local/bin/muyue"
echo "\`\`\`"
echo ""
echo "**macOS (Apple Silicon)**"
echo "\`\`\`bash"
echo "curl -sL ${DL_URL}/muyue-darwin-arm64.tar.gz | tar xz"
echo "chmod +x muyue-darwin-arm64"
echo "sudo mv muyue-darwin-arm64 /usr/local/bin/muyue"
echo "\`\`\`"
echo ""
echo "**Windows (x86_64)**"
echo "\`\`\`powershell"
echo "Invoke-WebRequest -Uri \"${DL_URL}/muyue-windows-amd64.zip\" -OutFile \"muyue.zip\""
echo "Expand-Archive -Path \"muyue.zip\" -DestinationPath \".\""
echo "Move-Item muyue-windows-amd64.exe C:\\Windows\\muyue.exe"
echo "\`\`\`"
} > /tmp/stable_changelog.md
echo "path=/tmp/stable_changelog.md" >> $GITHUB_OUTPUT
- name: Update CHANGELOG.md
run: |
if [ ! -f CHANGELOG.md ]; then
echo "# Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "All notable changes to this project will be documented in this file." >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)." >> CHANGELOG.md
echo "" >> CHANGELOG.md
fi
NEW_ENTRY=$(cat /tmp/stable_changelog.md)
EXISTING=$(tail -n +6 CHANGELOG.md)
{
head -5 CHANGELOG.md
echo ""
echo "$NEW_ENTRY"
echo ""
echo "$EXISTING"
} > CHANGELOG.md.new
mv CHANGELOG.md.new CHANGELOG.md
- name: Commit changelog
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
run: |
git config user.name "CI Bot"
git config user.email "ci@legion-muyue.fr"
git add CHANGELOG.md
git diff --cached --quiet && echo "No changelog changes" && exit 0
git commit -m "chore: update CHANGELOG for ${{ steps.version.outputs.version }}"
git push
- name: Create release
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
run: |
if [ -z "$GITEA_TOKEN" ]; then
echo "Warning: GITEATOKEN not set, skipping release"
exit 0
fi
VERSION=${{ steps.version.outputs.version }}
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
BODY=$(cat /tmp/stable_changelog.md)
RESPONSE=$(curl -s -X POST "${API}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\":\"${VERSION}\",
\"target_commitish\":\"main\",
\"name\":\"muyue ${VERSION}\",
\"body\":$(echo "$BODY" | jq -Rs .),
\"draft\":false,
\"prerelease\":false
}")
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release:"
echo "$RESPONSE"
exit 1
fi
echo "Release ID: ${RELEASE_ID}"
UPLOAD_URL="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets"
for file in dist/*.tar.gz dist/*.zip dist/checksums.txt; do
filename=$(basename "$file")
echo "Uploading ${filename}..."
curl -s -X POST "${UPLOAD_URL}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${file};filename=${filename}" > /dev/null
done
echo "Stable release ${VERSION} published!"