Skip to content
Merged
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
49 changes: 38 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ on:
push:
tags:
- 'v*'
# Manual recovery: rebuild the binaries of an existing tag for the listed
# targets only (comma-separated), e.g. tag=v0.16.0 targets=x86_64-apple-darwin,aarch64-apple-darwin.
workflow_dispatch:
inputs:
tag:
description: 'Existing tag to attach binaries to (e.g. v0.16.0)'
required: false
type: string
targets:
description: 'Comma-separated Rust targets to (re)build'
required: false
type: string

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -205,8 +216,15 @@ jobs:
Server binaries for common platforms are attached below. The embedder is not released as a bare binary because of its ONNX Runtime dependency — use the container image instead.

release-binaries-on-tag:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: >-
always() && (
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && needs.github-release-on-tag.result == 'success') ||
(github.event_name == 'workflow_dispatch' && inputs.tag != '')
)
needs: [github-release-on-tag]
env:
TAG: ${{ inputs.tag || github.ref_name }}
WANT: ${{ inputs.tag == '' || contains(inputs.targets, matrix.target) }}
timeout-minutes: 60
permissions:
contents: write
Expand All @@ -225,15 +243,16 @@ jobs:
archive: tar.gz
cross: true
# Cross-compiled from the Apple-Silicon runner. macos-13 (Intel)
# stalls indefinitely at `cargo build` here; macos-14 + the
# stalls indefinitely at `cargo build` here, and macos-14 is rejected
# by GitHub ("configuration not supported", v0.16.0); macos-15 + the
# x86_64-apple-darwin rustup target builds it in minutes. The
# macOS SDK ships both arch slices, so cc/openssl-src/bundled
# SQLite cross-compile with no extra linker config.
- target: x86_64-apple-darwin
runner: macos-14
runner: macos-15
archive: tar.gz
- target: aarch64-apple-darwin
runner: macos-14
runner: macos-15
archive: tar.gz
smoke: true
- target: x86_64-pc-windows-msvc
Expand All @@ -243,14 +262,18 @@ jobs:
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
if: env.WANT == 'true'
with:
ref: ${{ env.TAG }}

- name: Install Rust toolchain
if: env.WANT == 'true'
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install cross-compilation toolchain (Linux aarch64 only)
if: matrix.cross == true
if: env.WANT == 'true' && (matrix.cross == true)
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
Expand All @@ -271,33 +294,34 @@ jobs:
} >> "$GITHUB_ENV"

- name: Build server binary
if: env.WANT == 'true'
run: cargo build --release --locked --target ${{ matrix.target }} -p bsmcp-server

# Run the freshly built binary (native runners only; cross-built
# aarch64-linux and x86_64-apple are not executable on their runner).
- name: Smoke test --stdio
if: matrix.smoke == true
if: env.WANT == 'true' && (matrix.smoke == true)
shell: bash
run: |
BIN=target/${{ matrix.target }}/release/bsmcp-server
[ -f "$BIN.exe" ] && BIN="$BIN.exe"
bash scripts/smoke-stdio.sh "$BIN" --stdio

- name: Package archive (tar.gz)
if: matrix.archive == 'tar.gz'
if: env.WANT == 'true' && (matrix.archive == 'tar.gz')
run: |
STAGE=bsmcp-server-${{ github.ref_name }}-${{ matrix.target }}
STAGE=bsmcp-server-${{ env.TAG }}-${{ matrix.target }}
mkdir "$STAGE"
cp target/${{ matrix.target }}/release/bsmcp-server "$STAGE/"
cp README.md LICENSE "$STAGE/" 2>/dev/null || true
tar czf "$STAGE.tar.gz" "$STAGE"
echo "ARCHIVE=$STAGE.tar.gz" >> "$GITHUB_ENV"

- name: Package archive (zip)
if: matrix.archive == 'zip'
if: env.WANT == 'true' && (matrix.archive == 'zip')
shell: pwsh
run: |
$stage = "bsmcp-server-${{ github.ref_name }}-${{ matrix.target }}"
$stage = "bsmcp-server-${{ env.TAG }}-${{ matrix.target }}"
New-Item -ItemType Directory -Path $stage | Out-Null
Copy-Item "target/${{ matrix.target }}/release/bsmcp-server.exe" "$stage/"
if (Test-Path README.md) { Copy-Item README.md "$stage/" }
Expand All @@ -306,21 +330,24 @@ jobs:
"ARCHIVE=$stage.zip" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: SHA-256 checksum
if: env.WANT == 'true'
shell: bash
run: |
if command -v sha256sum >/dev/null; then sha256sum "$ARCHIVE" > "$ARCHIVE.sha256"
else shasum -a 256 "$ARCHIVE" > "$ARCHIVE.sha256"; fi
cat "$ARCHIVE.sha256"

- name: Attest build provenance
if: env.WANT == 'true'
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ env.ARCHIVE }}

- name: Attach archive to GitHub Release
if: env.WANT == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
tag_name: ${{ env.TAG }}
files: |
${{ env.ARCHIVE }}
${{ env.ARCHIVE }}.sha256
Loading