1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-09-01 06:20:15 +02:00

[Refactor] building on macOS-14 and add newer depends and include

PinBall game files
This commit is contained in:
Philip H. 2025-08-03 11:58:39 +02:00
parent cb9b7b8862
commit 7587036ec8
No known key found for this signature in database
2 changed files with 97 additions and 34 deletions

View file

@ -1,23 +1,66 @@
name: Make Release Builds
on: [workflow_dispatch]
on:
workflow_dispatch:
inputs:
version:
description: 'Automated Release'
required: true
type: string
jobs:
build-macos:
runs-on: macos-12
runs-on: macos-latest
timeout-minutes: 15
outputs:
dmg_name: ${{ steps.find_dmg.outputs.dmg_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@main
with:
ref: master
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 13
- name: Build macOS App
run: bash build-mac-app.sh
- run: bash build-mac-app.sh
- name: Get .dmg file name
id: find_dmg
run: |
FILE=$(ls SpaceCadetPinball-*-mac.dmg | head -n 1)
echo "Found dmg: $FILE"
echo "dmg_name=$FILE" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
- name: Upload artifact
uses: actions/upload-artifact@main
with:
name: mac-build
path: SpaceCadetPinball-*-mac.dmg
path: ${{ steps.find_dmg.outputs.dmg_name }}
release:
needs: build-macos
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@main
with:
name: mac-build
path: ./release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release/${{ needs.build-macos.outputs.dmg_name }}
asset_name: ${{ needs.build-macos.outputs.dmg_name }}
asset_content_type: application/octet-stream

View file

@ -2,44 +2,48 @@
set -xe
# === Prepare directories ===
mkdir -p Libs
cd Libs
sdl_version='2.30.4'
# === SDL2 ===
sdl_version='2.32.8'
sdl_filename="SDL2-$sdl_version.dmg"
sdl_url="https://github.com/libsdl-org/SDL/releases/download/release-$sdl_version/$sdl_filename"
sdl_mixer_version='2.8.0'
if [ ! -f "$sdl_filename" ]; then
curl -sSf -L -O "$sdl_url"
fi
echo "de07f71cc85cd8909c977e105c4f2ca419abd09b981c347e003592186caf6fa0 $sdl_filename" | shasum -a 256 -c
hdiutil attach "$sdl_filename" -quiet
cp -a /Volumes/SDL2/SDL2.framework .
hdiutil detach /Volumes/SDL2
# === SDL2_mixer ===
sdl_mixer_version='2.8.1'
sdl_mixer_filename="SDL2_mixer-$sdl_mixer_version.dmg"
sdl_mixer_url="https://github.com/libsdl-org/SDL_mixer/releases/download/release-$sdl_mixer_version/$sdl_mixer_filename"
mount_point="$(mktemp -d)"
if [ ! -f "$sdl_filename" ]; then
curl -sSf -L -O "$sdl_url"
fi
echo "2bf2cb8f6b44d584b14e8d4ca7437080d1d968fe3962303be27217b336b82249 $sdl_filename" | shasum -a 256 -c
hdiutil attach "$sdl_filename" -mountpoint "$mount_point" -quiet
cp -a "$mount_point/SDL2.framework" .
hdiutil detach "$mount_point"
if [ ! -f "$sdl_mixer_filename" ]; then
curl -sSf -L -O "$sdl_mixer_url"
curl -sSf -L -O "$sdl_mixer_url"
fi
echo "aea973d78f2949b0b2404379dfe775ac367c69485c1d25a5c59f109797f18adf $sdl_mixer_filename" | shasum -a 256 -c
hdiutil attach "$sdl_mixer_filename" -mountpoint "$mount_point" -quiet
cp -a "$mount_point/SDL2_mixer.framework" .
hdiutil detach "$mount_point"
echo "d74052391ee4d91836bf1072a060f1d821710f3498a54996c66b9a17c79a72d1 $sdl_mixer_filename" | shasum -a 256 -c
hdiutil attach "$sdl_mixer_filename" -quiet
cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework .
hdiutil detach /Volumes/SDL2_mixer
cd ..
cmake .
# === Build with CMake ===
cmake -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin .
cmake --build .
sw_version='2.1.1'
# === Prepare .app Bundle ===
sw_version='2.1.8'
mkdir -p SpaceCadetPinball.app/Contents/MacOS
mkdir -p SpaceCadetPinball.app/Contents/Resources
@ -51,10 +55,26 @@ cp -a Libs/SDL2.framework SpaceCadetPinball.app/Contents/Frameworks/
cp -a Libs/SDL2_mixer.framework SpaceCadetPinball.app/Contents/Frameworks/
cp -a bin/SpaceCadetPinball SpaceCadetPinball.app/Contents/MacOS/
# === Add game assets ===
curl -LO https://archive.org/download/winXP-pinball/Win32.Pinball.zip
unzip -o Win32.Pinball.zip -d PinballAssets/
# Copy contents of Pinball folder into Resources
cp -a PinballAssets/Pinball/* SpaceCadetPinball.app/Contents/Resources/
rm -rf Win32.Pinball.zip PinballAssets/
# === Finalize bundle ===
sed -i '' "s/CHANGEME_SW_VERSION/$sw_version/" SpaceCadetPinball.app/Contents/Info.plist
echo -n "APPLE" > SpaceCadetPinball.app/Contents/PkgInfo
echo -n "APPL????" > SpaceCadetPinball.app/Contents/PkgInfo
# === Ad-hoc code signing ===
codesign --force --deep --sign - SpaceCadetPinball.app
hdiutil create -fs HFS+ -srcfolder SpaceCadetPinball.app -volname "SpaceCadetPinball $sw_version" "SpaceCadetPinball-$sw_version-mac.dmg"
# === Create DMG ===
hdiutil create -fs HFS+ -srcfolder SpaceCadetPinball.app \
-volname "SpaceCadetPinball $sw_version" \
"SpaceCadetPinball-$sw_version-mac.dmg"
rm -r SpaceCadetPinball.app
# === Clean up ===
rm -rf SpaceCadetPinball.app