88 workflow_dispatch :
99
1010jobs :
11- build-and-release :
12- runs-on : ubuntu-latest
11+ build :
12+ name : Build ${{ matrix.name }}
13+ runs-on : ${{ matrix.os }}
14+ strategy :
15+ matrix :
16+ include :
17+ - name : Linux x86_64
18+ os : ubuntu-latest
19+ target : x86_64-unknown-linux-gnu
20+ bin_name : mcp-v8-linux
21+ build_cmd : cargo build --release --target x86_64-unknown-linux-gnu
22+ out_path : server/target/x86_64-unknown-linux-gnu/release/server
23+ - name : Linux ARM64
24+ os : ubuntu-latest
25+ target : aarch64-unknown-linux-gnu
26+ bin_name : mcp-v8-linux-arm64
27+ build_cmd : cargo build --release --target aarch64-unknown-linux-gnu
28+ out_path : server/target/aarch64-unknown-linux-gnu/release/server
29+ - name : macOS x86_64
30+ os : macos-13
31+ target : x86_64-apple-darwin
32+ bin_name : mcp-v8-macos
33+ build_cmd : cargo zigbuild --release --target x86_64-apple-darwin
34+ out_path : server/target/x86_64-apple-darwin/release/server
35+ - name : macOS ARM64
36+ os : macos-14
37+ target : aarch64-apple-darwin
38+ bin_name : mcp-v8-macos-arm64
39+ build_cmd : cargo zigbuild --release --target aarch64-apple-darwin
40+ out_path : server/target/aarch64-apple-darwin/release/server
1341
1442 steps :
1543 - name : Checkout code
1644 uses : actions/checkout@v4
1745
18- # install nix with determinat nix installer
1946 - uses : DeterminateSystems/nix-installer-action@main
2047 - uses : DeterminateSystems/magic-nix-cache-action@main
2148 - uses : DeterminateSystems/flake-checker-action@main
2249 - uses : Swatinem/rust-cache@v2
2350 with :
2451 cache-directories : " server"
25- # - install targets
26- - name : Install targets
27- run : |
28- nix develop --command rustup target add x86_64-apple-darwin
29- nix develop --command rustup target add aarch64-apple-darwin
30- nix develop --command rustup target add x86_64-unknown-linux-gnu
31- nix develop --command rustup target add aarch64-unknown-linux-gnu
32-
33- - name : Build macOS binary
34- run : cd server && nix develop --command cargo zigbuild --release --target x86_64-apple-darwin
35-
36- # arm macos
37- - name : Build arm macos binary
38- run : cd server && nix develop --command cargo zigbuild -- release --target aarch64-apple-darwin
39-
40- - name : Build Linux binary
41- run : cd server && nix develop --command cargo build --release --target x86_64-unknown-linux-gnu
42-
43- # arm linux
44- - name : Build arm linux binary
45- run : cd server && nix develop --command cargo build --release --target aarch64-unknown-linux-gnu
46-
47- - name : Prepare binaries for release
52+
53+ - name : Install target
54+ run : nix develop --command rustup target add ${{ matrix.target }}
55+
56+ - name : Build
57+ run : cd server && nix develop --command ${{ matrix.build_cmd }}
58+
59+ - name : Upload binary
60+ uses : actions/upload-artifact@v4
61+ with :
62+ name : ${{ matrix.bin_name }}
63+ path : ${{ matrix.out_path }}
64+
65+ release :
66+ needs : build
67+ runs-on : ubuntu-latest
68+ steps :
69+ - name : Download all artifacts
70+ uses : actions/download-artifact@v4
71+ with :
72+ path : dist
73+
74+ - name : Rename and organize binaries
4875 run : |
49- mkdir -p dist
50- cp server/target/x86_64-unknown-linux-gnu/release/server dist/mcp-v8-linux
51- cp server/target/x86_64-apple-darwin/release/server dist/mcp-v8-macos
76+ mkdir -p dist/final
77+ for dir in dist/*; do
78+ if [ -d "$dir" ]; then
79+ bin=$(ls "$dir")
80+ cp "$dir/$bin" "dist/final/$dir"
81+ fi
82+ done
5283
5384 - name : Create GitHub Release
5485 uses : softprops/action-gh-release@v2
5586 with :
56- files : |
57- dist/mcp-v8-linux
58- dist/mcp-v8-macos
87+ files : dist/final/*
5988 env :
6089 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments