name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v0.3.0) — created by this workflow"
required: true
permissions:
contents: write
packages: write
jobs:
notes:
runs-on: ubuntu-latest
env:
TAG: ${{ inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Verify tag matches Cargo.toml version
run: |
tag="${TAG#v}"
cargo_version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
[ "$tag" = "$cargo_version" ] || { echo "::error::tag v$tag != Cargo.toml version $cargo_version"; exit 1; }
- name: Extract release notes from CHANGELOG.md
run: |
awk '/^## \['"${TAG#v}"'\]/{f=1;next} /^## \[/{f=0} f' CHANGELOG.md > notes.md
[ -s notes.md ] || { echo "::error::no CHANGELOG.md section for ${TAG}"; exit 1; }
- name: Create GitHub Release with notes
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }}
body_path: notes.md
binaries:
needs: notes
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-unknown-linux-musl, os: ubuntu-latest }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04-arm }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install musl tools
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }} --bin mcp-multiplexer
- name: Package (unix)
if: runner.os != 'Windows'
shell: bash
run: |
strip target/${{ matrix.target }}/release/mcp-multiplexer || true
tar -czvf mcp-multiplexer-${{ matrix.target }}.tar.gz \
-C target/${{ matrix.target }}/release mcp-multiplexer
sha256sum mcp-multiplexer-${{ matrix.target }}.tar.gz \
> mcp-multiplexer-${{ matrix.target }}.tar.gz.sha256
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/mcp-multiplexer.exe -DestinationPath mcp-multiplexer-${{ matrix.target }}.zip
$f = "mcp-multiplexer-${{ matrix.target }}.zip"
"$((Get-FileHash $f).Hash.ToLower()) $f" | Out-File -Encoding ascii "$f.sha256"
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
files: mcp-multiplexer-${{ matrix.target }}.*
crates:
needs: binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --locked
- run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
docker:
needs: notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/johgirard/mcp-multiplexer:latest
ghcr.io/johgirard/mcp-multiplexer:${{ inputs.tag || github.ref_name }}