Refactor configuration handling and update README for SPICE kernels path #4
Workflow file for this run
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 single-file (server.Stdio) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| create_release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| publish: | |
| needs: create_release | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rid: [ linux-x64, win-x64, osx-arm64 ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "9.0.x" | |
| # Note: | |
| # - You can cross-publish for other OSes on ubuntu-latest by changing RID (e.g., win-x64, osx-arm64). | |
| # - macOS binaries produced here are unsigned; signing/notarization must be performed on macOS. | |
| - name: Publish single-file | |
| id: publish | |
| shell: bash | |
| env: | |
| RID: ${{ matrix.rid }} | |
| run: | | |
| set -euo pipefail | |
| PROJ="Server.Stdio/Server.Stdio.csproj" | |
| echo "Publishing $PROJ for RID=$RID" | |
| dotnet publish "$PROJ" -c Release -r "$RID" \ | |
| -p:PublishSingleFile=true \ | |
| -p:SelfContained=true \ | |
| -p:PublishTrimmed=false \ | |
| -p:IncludeNativeLibrariesForSelfExtract=true | |
| TF=$(dotnet msbuild "$PROJ" -getproperty:TargetFramework -nologo -v:quiet) | |
| PUB_DIR="$(dirname "$PROJ")/bin/Release/${TF}/${RID}/publish" | |
| echo "publish_dir=$PUB_DIR" >> "$GITHUB_OUTPUT" | |
| echo "Publish dir: $PUB_DIR" | |
| if [[ "$RID" == win* ]]; then | |
| EXE=$(find "$PUB_DIR" -maxdepth 1 -type f -name "*.exe" | head -n1 || true) | |
| else | |
| EXE=$(find "$PUB_DIR" -maxdepth 1 -type f -perm -u+x -printf '%f\n' -exec test -f "$PUB_DIR/{}" \; -print | head -n1 || true) | |
| # Fallback in case -printf isn't supported | |
| if [ -z "$EXE" ]; then EXE=$(find "$PUB_DIR" -maxdepth 1 -type f -perm -u+x | head -n1 || true); fi | |
| fi | |
| if [ -z "$EXE" ]; then | |
| echo "No executable found in $PUB_DIR" >&2 | |
| ls -la "$PUB_DIR" || true | |
| exit 1 | |
| fi | |
| # Normalize to absolute path | |
| if [[ ! "$EXE" = /* ]]; then EXE="$PUB_DIR/$EXE"; fi | |
| echo "exe=$EXE" >> "$GITHUB_OUTPUT" | |
| echo "Executable: $EXE" | |
| # Detect sidecar native libraries (needed on some RIDs like macOS) | |
| SIDECAR="" | |
| for pattern in "*.so" "*.dylib"; do | |
| CAND=$(find "$PUB_DIR" -maxdepth 1 -type f -name "$pattern" | head -n1 || true) | |
| if [ -n "$CAND" ]; then SIDECAR="$CAND"; break; fi | |
| done | |
| echo "sidecar=$SIDECAR" >> "$GITHUB_OUTPUT" | |
| if [ -n "$SIDECAR" ]; then echo "Detected sidecar: $SIDECAR"; else echo "No sidecar native lib detected"; fi | |
| - name: Prepare native asset | |
| id: package | |
| shell: bash | |
| env: | |
| RID: ${{ matrix.rid }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| set -euo pipefail | |
| EXT="" | |
| if [[ "$RID" == win* ]]; then EXT=".exe"; fi | |
| BASENAME="mcp-server-stdio-${TAG}-${RID}${EXT}" | |
| SRC="${{ steps.publish.outputs.exe }}" | |
| DEST_DIR="$(mktemp -d)" | |
| DEST="$DEST_DIR/$BASENAME" | |
| cp "$SRC" "$DEST" | |
| chmod +x "$DEST" || true | |
| echo "asset=$DEST" >> "$GITHUB_OUTPUT" | |
| echo "Prepared native asset: $DEST" | |
| # If sidecar exists, prepare it with a deterministic name | |
| SIDECAR_SRC="${{ steps.publish.outputs.sidecar }}" | |
| if [ -n "$SIDECAR_SRC" ]; then | |
| SNAME="mcp-server-stdio-${TAG}-${RID}-$(basename "$SIDECAR_SRC")" | |
| SC_DEST="$DEST_DIR/$SNAME" | |
| cp "$SIDECAR_SRC" "$SC_DEST" | |
| echo "sidecar_asset=$SC_DEST" >> "$GITHUB_OUTPUT" | |
| echo "Prepared sidecar asset: $SC_DEST" | |
| else | |
| echo "sidecar_asset=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Upload executable to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| files: ${{ steps.package.outputs.asset }} | |
| fail_on_unmatched_files: true | |
| - name: Upload sidecar (if any) to GitHub Release | |
| if: ${{ steps.package.outputs.sidecar_asset != '' }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| files: ${{ steps.package.outputs.sidecar_asset }} | |
| fail_on_unmatched_files: true | |
| - name: Upload artifact (native executable) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: io-aerosapce-mcp-${{ github.ref_name }}-${{ matrix.rid }} | |
| path: ${{ steps.package.outputs.asset }} | |
| if-no-files-found: error | |
| - name: Upload artifact (sidecar if any) | |
| if: ${{ steps.package.outputs.sidecar_asset != '' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: io-aerosapce-mcp-${{ github.ref_name }}-${{ matrix.rid }}-sidecar | |
| path: ${{ steps.package.outputs.sidecar_asset }} | |
| if-no-files-found: error |