|
| 1 | +name: Release single-file (server.Stdio) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + rid: |
| 7 | + description: ".NET Runtime Identifier (e.g., linux-x64, win-x64, osx-arm64)" |
| 8 | + required: true |
| 9 | + default: "linux-x64" |
| 10 | + push: |
| 11 | + tags: |
| 12 | + - "v*" |
| 13 | + |
| 14 | +jobs: |
| 15 | + publish: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Setup .NET |
| 22 | + uses: actions/setup-dotnet@v4 |
| 23 | + with: |
| 24 | + dotnet-version: "9.0.x" |
| 25 | + |
| 26 | + # Note: |
| 27 | + # - You can cross-publish for other OSes on ubuntu-latest by changing RID (e.g., win-x64, osx-arm64). |
| 28 | + # - macOS binaries produced here are unsigned; signing/notarization must be performed on macOS. |
| 29 | + - name: Publish single-file |
| 30 | + id: publish |
| 31 | + shell: bash |
| 32 | + env: |
| 33 | + RID: ${{ github.event.inputs.rid || 'linux-x64' }} |
| 34 | + run: | |
| 35 | + set -euo pipefail |
| 36 | + PROJ="Server.Stdio/Server.Stdio.csproj" |
| 37 | + echo "Publishing $PROJ for RID=$RID" |
| 38 | +
|
| 39 | + dotnet publish "$PROJ" -c Release -r "$RID" \ |
| 40 | + -p:PublishSingleFile=true \ |
| 41 | + -p:SelfContained=true \ |
| 42 | + -p:PublishTrimmed=false |
| 43 | +
|
| 44 | + TF=$(dotnet msbuild "$PROJ" -getproperty:TargetFramework -nologo -v:quiet) |
| 45 | + PUB_DIR="$(dirname "$PROJ")/bin/Release/${TF}/${RID}/publish" |
| 46 | + echo "publish_dir=$PUB_DIR" >> "$GITHUB_OUTPUT" |
| 47 | + echo "Publish dir: $PUB_DIR" |
| 48 | +
|
| 49 | + if [[ "$RID" == win* ]]; then |
| 50 | + EXE=$(find "$PUB_DIR" -maxdepth 1 -type f -name "*.exe" | head -n1 || true) |
| 51 | + else |
| 52 | + EXE=$(find "$PUB_DIR" -maxdepth 1 -type f -perm -u+x | head -n1 || true) |
| 53 | + fi |
| 54 | +
|
| 55 | + if [ -z "$EXE" ]; then |
| 56 | + echo "No executable found in $PUB_DIR" >&2 |
| 57 | + ls -la "$PUB_DIR" || true |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + echo "exe=$EXE" >> "$GITHUB_OUTPUT" |
| 61 | + echo "Executable: $EXE" |
| 62 | +
|
| 63 | + - name: Upload executable artifact |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: io-aerosapce-mcp-${{ github.ref_name }}-${{ github.event.inputs.rid || 'linux-x64' }} |
| 67 | + path: ${{ steps.publish.outputs.exe }} |
| 68 | + if-no-files-found: error |
0 commit comments