Release Rust Server #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Rust Server | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # Triggers on version tags like v1.2.3 | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - name: Linux x86_64 | |
| os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| bin_name: mcp-v8-linux | |
| build_cmd: cargo build --release --target x86_64-unknown-linux-gnu | |
| out_path: server/target/x86_64-unknown-linux-gnu/release/server | |
| - name: macOS x86_64 | |
| os: macos-13 | |
| target: x86_64-apple-darwin | |
| bin_name: mcp-v8-macos | |
| build_cmd: cargo build --release --target x86_64-apple-darwin | |
| out_path: server/target/x86_64-apple-darwin/release/server | |
| - name: macOS ARM64 | |
| os: macos-14 | |
| target: aarch64-apple-darwin | |
| bin_name: mcp-v8-macos-arm64 | |
| build_cmd: cargo build --release --target aarch64-apple-darwin | |
| out_path: server/target/aarch64-apple-darwin/release/server | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: DeterminateSystems/flake-checker-action@main | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-directories: "server" | |
| - name: Install target | |
| run: nix develop --command rustup target add ${{ matrix.target }} | |
| - name: Build | |
| run: cd server && nix develop --command ${{ matrix.build_cmd }} | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.bin_name }} | |
| path: ${{ matrix.out_path }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Rename and organize binaries | |
| run: | | |
| echo "Listing dist directory:" | |
| ls -l dist | |
| echo "Listing all subdirectories in dist:" | |
| for dir in dist/*; do | |
| if [ -d "$dir" ]; then | |
| echo "Contents of $dir:" | |
| ls -l "$dir" | |
| fi | |
| done | |
| mkdir -p dist/final | |
| for dir in dist/*; do | |
| if [ -d "$dir" ] && [ "$dir" != "dist/final" ]; then | |
| echo "Processing directory: $dir" | |
| bin=$(ls "$dir") | |
| echo "Found binary: $bin in $dir" | |
| echo "Copying $dir/$bin to dist/final/$bin" | |
| cp "$dir/$bin" "dist/final/$bin" | |
| fi | |
| done | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/final/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |