-
Notifications
You must be signed in to change notification settings - Fork 6
126 lines (112 loc) · 3.97 KB
/
Copy pathcc-binary-release.yml
File metadata and controls
126 lines (112 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: cc plugin binary release
# ---------------------------------------------------------------
# builds standalone cc-server binaries for darwin-arm64,
# darwin-x64, linux-arm64, linux-x64 using `bun build --compile`,
# attaches them to the github release for any tag matching v*.
#
# the plugin's mcpServer launcher prefers a binary at
# plugins/cc/dist/cc-server-${os}-${arch} if present, falling
# back to `bun server.ts` otherwise. shipping binaries is
# strictly opt-in for the end user (the source path keeps working).
#
# cost: $0 (uses GH-hosted runners)
# ---------------------------------------------------------------
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'tag to attach binaries to (e.g. v2.3.0)'
required: true
permissions:
contents: write
concurrency:
group: "cc-binary-${{ github.ref }}"
cancel-in-progress: false
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: darwin-arm64
runner: macos-14
- target: darwin-x64
runner: macos-13
- target: linux-arm64
runner: ubuntu-24.04-arm
- target: linux-x64
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install plugin deps
working-directory: plugins/cc
run: bun install --frozen-lockfile
- name: Compile cc-server (${{ matrix.target }})
working-directory: plugins/cc
run: |
bun build --compile --minify \
--target=bun-${{ matrix.target }} \
server.ts \
--outfile dist/cc-server-${{ matrix.target }}
- name: Smoke test (native arch only)
if: matrix.target == 'darwin-arm64' || matrix.target == 'linux-x64' || matrix.target == 'linux-arm64'
working-directory: plugins/cc
run: |
set -euo pipefail
chmod +x dist/cc-server-${{ matrix.target }}
response=$(echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0"}}}' | timeout 5 ./dist/cc-server-${{ matrix.target }} || true)
echo "$response"
echo "$response" | grep -q '"name":"cc"' || (echo "smoke failed: server did not return serverInfo"; exit 1)
echo "smoke ok"
- uses: actions/upload-artifact@v7
with:
name: cc-server-${{ matrix.target }}
path: plugins/cc/dist/cc-server-${{ matrix.target }}
if-no-files-found: error
retention-days: 7
release:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: List downloaded artifacts
run: ls -la dist/
- name: Resolve tag
id: tag
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
fi
- name: Attach binaries to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="${{ steps.tag.outputs.tag }}"
if ! gh release view "$TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
gh release create "$TAG" \
--repo "${{ github.repository }}" \
--title "$TAG" \
--notes "auto-generated release with cc-server binaries"
fi
gh release upload "$TAG" \
--repo "${{ github.repository }}" \
--clobber \
dist/cc-server-darwin-arm64 \
dist/cc-server-darwin-x64 \
dist/cc-server-linux-arm64 \
dist/cc-server-linux-x64