@@ -240,9 +240,87 @@ jobs:
240240 with :
241241 name : ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-bsd
242242 path : artifact/*
243+ mcpb :
244+ name : MCPB
245+ needs : [macos, windows, linux]
246+ runs-on : ubuntu-latest
247+ permissions :
248+ contents : read
249+ packages : write
250+ strategy :
251+ matrix :
252+ variant :
253+ - { platform: darwin, arch: arm64, os: macos-15, architecture: arm }
254+ - { platform: darwin, arch: x64, os: macos-15-intel, architecture: intel }
255+ - { platform: win32, arch: arm64, os: windows-latest, architecture: arm64 }
256+ - { platform: win32, arch: x64, os: windows-latest, architecture: x64 }
257+ - { platform: linux, arch: x64, os: ubuntu-24.04, architecture: '' }
258+ steps :
259+ - name : Checkout
260+ uses : actions/checkout@v4
261+ with :
262+ fetch-depth : 0
263+ - name : Get build number
264+ run : |
265+ echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
266+ - name : Download artifact
267+ uses : actions/download-artifact@v4
268+ with :
269+ name : ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-${{ matrix.variant.platform == 'darwin' && format('macos-{0}', matrix.variant.architecture) || matrix.variant.platform == 'linux' && matrix.variant.os || format('windows-{0}', matrix.variant.architecture) }}
270+ path : download
271+ - name : Prepare MCPB structure
272+ run : |
273+ mkdir -p mcpb/server
274+ mkdir -p mcpb/mcp/resources
275+
276+ # Copy gamecontrollerdb.txt
277+ cp download/gamecontrollerdb.txt mcpb/
278+
279+ # Copy MCP resources
280+ cp -r download/mcp/resources/* mcpb/mcp/resources/
281+
282+ # Copy binary based on platform
283+ if [ "${{ matrix.variant.platform }}" = "darwin" ]; then
284+ # Extract macOS app bundle
285+ cd download
286+ unzip -q ${{ env.NAME_UPPER }}.app.zip
287+ cd ..
288+ cp download/${{ env.NAME_UPPER }}.app/Contents/MacOS/${{ env.NAME_LOWER }} mcpb/server/
289+ elif [ "${{ matrix.variant.platform }}" = "win32" ]; then
290+ cp download/${{ env.NAME_UPPER }}.exe mcpb/server/
291+ cp download/SDL2.dll mcpb/server/
292+ else
293+ cp download/${{ env.NAME_LOWER }} mcpb/server/
294+ fi
295+ - name : Create manifest.json
296+ run : |
297+ # Determine binary name based on platform
298+ if [ "${{ matrix.variant.platform }}" = "win32" ]; then
299+ BINARY_NAME="${{ env.NAME_UPPER }}.exe"
300+ else
301+ BINARY_NAME="${{ env.NAME_LOWER }}"
302+ fi
303+
304+ # Copy template and replace placeholders
305+ cp platforms/shared/desktop/mcp/manifest.json.template mcpb/manifest.json
306+ sed -i "s/{{NAME_LOWER}}/${{ env.NAME_LOWER }}/g" mcpb/manifest.json
307+ sed -i "s/{{NAME_UPPER}}/${{ env.NAME_UPPER }}/g" mcpb/manifest.json
308+ sed -i "s/{{VERSION}}/${{ env.BUILD_NUMBER }}/g" mcpb/manifest.json
309+ sed -i "s/{{PLATFORM}}/${{ matrix.variant.platform }}/g" mcpb/manifest.json
310+ sed -i "s/{{ARCH}}/${{ matrix.variant.arch }}/g" mcpb/manifest.json
311+ sed -i "s|{{BINARY_NAME}}|$BINARY_NAME|g" mcpb/manifest.json
312+ - name : Create MCPB package
313+ run : |
314+ cd mcpb
315+ zip -r ../${{ env.NAME_LOWER }}-mcp-${{ matrix.variant.platform }}-${{ matrix.variant.arch }}.mcpb *
316+ - name : Archive MCPB
317+ uses : actions/upload-artifact@v4
318+ with :
319+ name : ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-mcpb-${{ matrix.variant.platform }}-${{ matrix.variant.arch }}
320+ path : ${{ env.NAME_LOWER }}-mcp-${{ matrix.variant.platform }}-${{ matrix.variant.arch }}.mcpb
243321 release :
244322 name : Release
245- needs : [linux, macos, windows, bsd]
323+ needs : [linux, macos, windows, bsd, mcpb ]
246324 if : github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/')
247325 runs-on : ubuntu-latest
248326 permissions :
@@ -263,21 +341,29 @@ jobs:
263341 with :
264342 pattern : ${{ env.NAME_UPPER }}-${{ env.BUILD_NUMBER }}-*
265343 path : release
266- - name : Zip directories
344+ - name : Zip directories (non-MCPB)
267345 run : |
268346 cd release
269347 for f in *; do
270- if [ -d "$f" ]; then
348+ if [ -d "$f" ] && [[ ! "$f" =~ mcpb ]] ; then
271349 cd $f
272350 echo "Compressing $f"
273351 zip -r $f.zip *
274352 mv $f.zip ../
275353 cd ..
276354 fi
277355 done
356+ - name : Move MCPB packages
357+ run : |
358+ cd release
359+ for f in *-mcpb-*; do
360+ if [ -d "$f" ]; then
361+ mv $f/*.mcpb ./
362+ fi
363+ done
278364 - name : Create release
279365 run : |
280- gh release create ${{ github.ref_name }} ./release/*.zip \
366+ gh release create ${{ github.ref_name }} ./release/*.zip ./release/*.mcpb \
281367 --title "${{ env.NAME_UPPER }} ${{ github.ref_name }}" \
282368 --draft \
283369 --generate-notes
0 commit comments