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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release
# Publishes prebuilt binaries to GitHub Releases whenever a `v*` tag is
# pushed (the same trigger used by publish.yml for crates.io). Every matrix
# cell builds one binary (target x Rust toolchain) and uploads it as a
# compressed archive plus a SHA-256 checksum, so users without Rust or Cargo
# can download a binary and drop it straight into their `bin` folder.
#
# Uses the taiki-e release stack:
# - create-gh-release-action creates the GitHub Release for the tag
# - setup-cross-toolchain-action installs NDK/GCC cross linkers where the
# target cannot be built with the runner's native toolchain
# - upload-rust-binary-action builds (with rustup target add) and uploads
permissions:
contents: read
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: taiki-e/create-gh-release-action@v1
with:
allow-missing-changelog: true # repo has no CHANGELOG.md; use generated notes
upload-assets:
name: Upload ${{ matrix.target }} (rust ${{ matrix.toolchain }})
needs: create-release
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
contents: write
strategy:
fail-fast: false
matrix:
# Build each target with the MSRV (1.97.1, pinned in rust-toolchain.toml)
# and with latest stable, so users can pick the compatibility level.
# RUSTUP_TOOLCHAIN (set below) overrides rust-toolchain.toml.
# `target` and `toolchain` are matrix dimensions (13 x 2 = 26 jobs);
# the `include` entries merge the runner OS into each target combo.
target:
# Linux (glibc and fully static musl builds)
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
# macOS
- x86_64-apple-darwin
- aarch64-apple-darwin
# iOS. Note: the binary is an unsigned Mach-O. iOS has no
# user-installable `bin` folder, so it cannot be run on a device
# as-is; this artifact is for signing/embedding into an app.
- aarch64-apple-ios
# Windows (static CRT, no VC++ runtime needed on the target)
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
# Android (NDK; usable e.g. under Termux)
- aarch64-linux-android
- x86_64-linux-android
- armv7-linux-androideabi
toolchain:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
- target: aarch64-unknown-linux-musl
os: ubuntu-22.04
- target: armv7-unknown-linux-musleabihf
os: ubuntu-22.04
- target: x86_64-apple-darwin
os: macos-15
- target: aarch64-apple-darwin
os: macos-15
- target: aarch64-apple-ios
os: macos-15
- target: x86_64-pc-windows-msvc
os: windows-2022
- target: aarch64-pc-windows-msvc
os: windows-2022
- target: aarch64-linux-android
os: ubuntu-22.04
- target: x86_64-linux-android
os: ubuntu-22.04
- target: armv7-linux-androideabi
os: ubuntu-22.04
env:
RUSTUP_TOOLCHAIN: ${{ matrix.toolchain }}
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
# Apple targets need only `rustup target add`, which
# upload-rust-binary-action performs itself, so skip them here.
- name: Install cross-compilation toolchain
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
runner: none
if: ${{ !contains(matrix.target, '-apple-') }}
- name: Link Windows binaries against the static CRT
run: printf 'RUSTFLAGS=%s\n' "${RUSTFLAGS} -C target-feature=+crt-static" >>"${GITHUB_ENV}"
shell: bash
if: contains(matrix.target, '-windows-msvc')
- name: Build fully static Linux binaries
run: printf 'RUSTFLAGS=%s\n' "${RUSTFLAGS} -C target-feature=+crt-static -C link-self-contained=yes" >>"${GITHUB_ENV}"
shell: bash
if: contains(matrix.target, '-linux-musl')
- name: Support older macOS versions
run: |
case "${{ matrix.target }}" in
x86_64-apple-darwin) echo "MACOSX_DEPLOYMENT_TARGET=10.12" >>"${GITHUB_ENV}" ;;
aarch64-apple-darwin) echo "MACOSX_DEPLOYMENT_TARGET=11.0" >>"${GITHUB_ENV}" ;;
esac
shell: bash
# Archive names embed a stable label (`-rust-msrv` / `-rust-stable`)
# instead of the exact rustc version, so the
# `/releases/latest/download/<name>` URLs in the README and docs stay
# valid across releases and Rust updates.
- name: Record Rust build label for artifact names
run: |
case "${{ matrix.toolchain }}" in
1.97.1) echo "RUSTC_LABEL=rust-msrv" >>"${GITHUB_ENV}" ;;
*) echo "RUSTC_LABEL=rust-stable" >>"${GITHUB_ENV}" ;;
esac
shell: bash
- name: Build and upload binary to GitHub Releases
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: modelcontextprotocol
target: ${{ matrix.target }}
archive: $bin-$target-${{ env.RUSTC_LABEL }}
locked: true
tar: unix
zip: windows
checksum: sha256
include: LICENSE
asset: install.sh