Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .build-cache/server-darwin-amd64.hash

This file was deleted.

1 change: 0 additions & 1 deletion .build-cache/server-darwin-arm64.hash

This file was deleted.

1 change: 0 additions & 1 deletion .build-cache/server-linux-amd64.hash

This file was deleted.

1 change: 0 additions & 1 deletion .build-cache/server-windows-amd64.hash

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build:
name: Build and Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整历史用于生成 changelog

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'

- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y zip

- name: Build server
run: |
chmod +x build.sh
./build.sh all-server -v ${{ steps.get_version.outputs.VERSION }}

- name: Generate changelog
id: changelog
run: |
# 找到上一个 tag
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
RANGE="HEAD"
else
RANGE="${PREV_TAG}..HEAD"
fi

# 获取所有 commit,去掉 emoji 前缀,按 Angular commit 类型分类
CHANGELOG=""
for TYPE_LABEL in "feat:Features" "fix:Bug Fixes" "perf:Performance" "refactor:Refactor" "docs:Documentation" "test:Tests" "ci:CI" "build:Build" "chore:Chores"; do
TYPE="${TYPE_LABEL%%:*}"
LABEL="${TYPE_LABEL##*:}"
ITEMS=$(git log "$RANGE" --pretty=format:"%s|%h" | sed 's/^[^a-zA-Z]*//' | grep -E "^${TYPE}(\(|:)" | sed 's/\(.*\)|\(.*\)/- \1 (\2)/' || true)
if [ -n "$ITEMS" ]; then
CHANGELOG="${CHANGELOG}## ${LABEL}\n${ITEMS}\n\n"
fi
done

if [ -z "$CHANGELOG" ]; then
ALL=$(git log "$RANGE" --pretty=format:"- %s (%h)")
CHANGELOG="## Changes\n${ALL}\n"
fi

# 保存到文件
echo -e "$CHANGELOG" > CHANGELOG.md

# 输出到 GitHub Actions
echo "changelog<<EOF" >> $GITHUB_OUTPUT
cat CHANGELOG.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
files: |
dist/server/claude-server-linux-amd64
dist/server/claude-server-darwin-amd64
dist/server/claude-server-darwin-arm64
dist/server/claude-server-windows-amd64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ desktop/
# Go 相关
*.test
*.out
vendor/

# 配置文件(包含敏感信息)
config.yaml
Expand Down Expand Up @@ -97,3 +96,6 @@ tools/license-verify-server/license-verify-server
*.license
licenses/
activations/

.omc
.build-cache
40 changes: 18 additions & 22 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ parse_args() {
print_help
exit 0
;;
server|desktop|license-server|all|clean)
server|desktop|license-server|all|clean|all-server)
TARGET="$1"
shift
;;
Expand Down Expand Up @@ -244,18 +244,8 @@ build_server() {

go build -ldflags="-s -w -X main.Version=$version" \
-o "$DIST_DIR/server/$output_name" .

# 打包
cd "$DIST_DIR/server"
if [ "$goos" = "windows" ]; then
zip -q "${output_name%.exe}.zip" "$output_name"
rm "$output_name"
log_success "Server [$platform] -> $DIST_DIR/server/${output_name%.exe}.zip"
else
tar -czf "$output_name.tar.gz" "$output_name"
rm "$output_name"
log_success "Server [$platform] -> $DIST_DIR/server/$output_name.tar.gz"
fi

log_success "Server [$platform] -> $DIST_DIR/server/$output_name"

update_cache "server" "$platform"
}
Expand Down Expand Up @@ -489,9 +479,10 @@ verify_build() {

case "$TARGET" in
server)
expected_files+=("$DIST_DIR/server/claude-server-$CURRENT_OS-$CURRENT_ARCH.tar.gz")
if [ "$CURRENT_OS" = "darwin" ]; then
expected_files+=("$DIST_DIR/server/claude-server-darwin-$CURRENT_ARCH.tar.gz")
if [ "$CURRENT_OS" = "windows" ]; then
expected_files+=("$DIST_DIR/server/claude-server-$CURRENT_OS-$CURRENT_ARCH.exe")
else
expected_files+=("$DIST_DIR/server/claude-server-$CURRENT_OS-$CURRENT_ARCH")
fi
;;
desktop)
Expand All @@ -505,10 +496,10 @@ verify_build() {
;;
all)
# Server 所有平台
expected_files+=("$DIST_DIR/server/claude-server-linux-amd64.tar.gz")
expected_files+=("$DIST_DIR/server/claude-server-darwin-amd64.tar.gz")
expected_files+=("$DIST_DIR/server/claude-server-darwin-arm64.tar.gz")
expected_files+=("$DIST_DIR/server/claude-server-windows-amd64.zip")
expected_files+=("$DIST_DIR/server/claude-server-linux-amd64")
expected_files+=("$DIST_DIR/server/claude-server-darwin-amd64")
expected_files+=("$DIST_DIR/server/claude-server-darwin-arm64")
expected_files+=("$DIST_DIR/server/claude-server-windows-amd64.exe")
# Desktop
if [ "$CURRENT_OS" = "darwin" ]; then
expected_files+=("$DIST_DIR/desktop/Claude-API-Server-macOS-$CURRENT_ARCH.zip")
Expand All @@ -520,7 +511,7 @@ verify_build() {
*)
# 默认构建
if [ "$CURRENT_OS" = "darwin" ]; then
expected_files+=("$DIST_DIR/server/claude-server-darwin-$CURRENT_ARCH.tar.gz")
expected_files+=("$DIST_DIR/server/claude-server-darwin-$CURRENT_ARCH")
expected_files+=("$DIST_DIR/desktop/Claude-API-Server-macOS-$CURRENT_ARCH.zip")
expected_files+=("$DIST_DIR/desktop/Claude-API-Server-Windows-amd64.zip")
fi
Expand All @@ -532,6 +523,7 @@ verify_build() {
echo ""

for file in "${expected_files[@]}"; do
echo $file
if [ -f "$file" ]; then
local size=$(ls -lh "$file" 2>/dev/null | awk '{print $5}')
echo -e " ${GREEN}✓${NC} $(basename "$file") ($size)"
Expand Down Expand Up @@ -598,7 +590,8 @@ main() {
IFS='/' read -r goos goarch <<< "$PLATFORM"
build_server "$goos" "$goarch"
else
build_server "$CURRENT_OS" "$CURRENT_ARCH"
# 构建所有平台的 server
build_all_servers
fi
;;
desktop)
Expand All @@ -623,6 +616,9 @@ main() {
build_license_server "$CURRENT_OS" "$CURRENT_ARCH"
fi
;;
all-server)
build_all_servers
;;
all)
build_all_servers
build_all_desktops
Expand Down
85 changes: 85 additions & 0 deletions frontend/vendor/css/github-dark.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em
}

code.hljs {
padding: 3px 5px
}

/*!
Theme: GitHub Dark
Description: Dark theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15

Outdated base version: https://github.com/primer/github-syntax-dark
Current colors taken from GitHub's CSS
*/
.hljs {
color: #c9d1d9;
background: #0d1117
}

.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_ {
color: #ff7b72
}

.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_ {
color: #d2a8ff
}

.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable {
color: #79c0ff
}

.hljs-meta .hljs-string,.hljs-regexp,.hljs-string {
color: #a5d6ff
}

.hljs-built_in,.hljs-symbol {
color: #ffa657
}

.hljs-code,.hljs-comment,.hljs-formula {
color: #8b949e
}

.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag {
color: #7ee787
}

.hljs-subst {
color: #c9d1d9
}

.hljs-section {
color: #1f6feb;
font-weight: 700
}

.hljs-bullet {
color: #f2cc60
}

.hljs-emphasis {
color: #c9d1d9;
font-style: italic
}

.hljs-strong {
color: #c9d1d9;
font-weight: 700
}

.hljs-addition {
color: #aff5b4;
background-color: #033a16
}

.hljs-deletion {
color: #ffdcd7;
background-color: #67060c
}
85 changes: 85 additions & 0 deletions frontend/vendor/css/github.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em
}

code.hljs {
padding: 3px 5px
}

/*!
Theme: GitHub
Description: Light theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15

Outdated base version: https://github.com/primer/github-syntax-light
Current colors taken from GitHub's CSS
*/
.hljs {
color: #24292e;
background: #fff
}

.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_ {
color: #d73a49
}

.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_ {
color: #6f42c1
}

.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable {
color: #005cc5
}

.hljs-meta .hljs-string,.hljs-regexp,.hljs-string {
color: #032f62
}

.hljs-built_in,.hljs-symbol {
color: #e36209
}

.hljs-code,.hljs-comment,.hljs-formula {
color: #6a737d
}

.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag {
color: #22863a
}

.hljs-subst {
color: #24292e
}

.hljs-section {
color: #005cc5;
font-weight: 700
}

.hljs-bullet {
color: #735c0f
}

.hljs-emphasis {
color: #24292e;
font-style: italic
}

.hljs-strong {
color: #24292e;
font-weight: 700
}

.hljs-addition {
color: #22863a;
background-color: #f0fff4
}

.hljs-deletion {
color: #b31d28;
background-color: #ffeef0
}
Loading