.github/workflows/build_mac.yml #5
This file contains 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
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually ftarget the Actions tab | |
workflow_dispatch: | |
env: | |
GAME_NAME: Puzzle Land playdate | |
GAME_ID: com.github.joyrider3774.puzzleland_playdate | |
#viewed from Source directory | |
GAME_ICON_FILE: metadata/icon.png | |
ARTIFACT_NAME: Puzzle Land playdate Mac Os (x64) | |
jobs: | |
build: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout Playdate SDL2 Api Sources | |
uses: actions/checkout@v3 | |
with: | |
repository: 'joyrider3774/Playdate_Api_SDL2' | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
path: tmp | |
- name: Setup homebrew stuff | |
run: | | |
brew update | |
brew install --ignore-dependencies portaudio fluid-synth libxmp gettext glib libavif jpeg-turbo jpeg-xl libavif libpng libtiff webp | |
brew install --ignore-dependencies gnu-sed SDL2 SDL2_Mixer SDL2_Image SDL2_ttf SDL2_gfx dylibbundler | |
- name: Grab Music | |
env: | |
music_download: ${{ secrets.music_download }} | |
run: | | |
curl $music_download --output music.zip | |
- name: Extract Music | |
run: | | |
unzip music.zip | |
mv music tmp/Source/music | |
rm music.zip | |
- name: move things to correct directories | |
run: | | |
rm -rf ./src/srcgame | |
mv tmp/src ./src/srcgame | |
cp -Rf tmp/Source/. ./Source | |
- name: enable masks in sourcecode | |
run: | | |
gsed -i 's/pd_api_gfx_disable_masks = true/pd_api_gfx_disable_masks = false/g' ./src/srcstub/gamestub.cpp | |
- name: Build Game | |
run: | | |
make "SRC_C_DIR=src/srcgame src/srcgame/gameobjects src/srcgame/gamestates" WINDOWSCALE=2 SCREENRESX=320 SCREENRESY=240 | |
- name: run dylibbundler | |
run: | | |
cd ./Source | |
dylibbundler -cd -b -x ./game | |
- name: create app | |
run: | | |
mkdir "$GAME_NAME.app" | |
mkdir "$GAME_NAME.app/Contents" | |
cp -R ./Source "./$GAME_NAME.app/Contents/MacOs" | |
mv "./$GAME_NAME.app/Contents/MacOs/libs" "./$GAME_NAME.app/Contents/libs" | |
mkdir "$GAME_NAME.app/Contents/Resources" | |
mkdir Icon.iconset | |
sips -z 16 16 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/icon_16x16.png | |
sips -z 32 32 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/[email protected] | |
sips -z 32 32 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/icon_32x32.png | |
sips -z 64 64 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/[email protected] | |
sips -z 128 128 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/icon_128x128.png | |
sips -z 256 256 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/[email protected] | |
sips -z 256 256 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/icon_256x256.png | |
sips -z 512 512 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/[email protected] | |
sips -z 512 512 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/icon_512x512.png | |
sips -z 1024 1024 "./$GAME_NAME.app/Contents/MacOs/$GAME_ICON_FILE" --out Icon.iconset/[email protected] | |
iconutil -c icns Icon.iconset | |
mv icon.icns "./$GAME_NAME.app/Contents/Resources/Icon.icns" | |
echo "<?xml version='1.0' encoding='UTF-8'?>" > "./$GAME_NAME.app/Contents/Info.plist" | |
echo "<!DOCTYPE plist PUBLIC '-//Apple Computer//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo "<plist version='1.0'>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <dict>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleExecutable</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>game.sh</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleIdentifier</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>$GAME_ID</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleName</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>$GAME_NAME</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleIconFile</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>Icon.icns</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleShortVersionString</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>0.01</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundleInfoDictionaryVersion</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>6.0</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>CFBundlePackageType</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <string>APPL</string>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>IFMajorVersion</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <integer>0</integer>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <key>IFMinorVersion</key>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " <integer>1</integer>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo " </dict>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo "</plist>" >> "./$GAME_NAME.app/Contents/Info.plist" | |
echo "#!/bin/bash" > "./$GAME_NAME.app/Contents/MacOs/game.sh" | |
echo "cd \"\${0%/*}\"" >> "./$GAME_NAME.app/Contents/MacOs/game.sh" | |
echo "./game -a" >> "./$GAME_NAME.app/Contents/MacOs/game.sh" | |
chmod +x "./$GAME_NAME.app/Contents/MacOs/game.sh" | |
- name: prepare artifact | |
# first tar.gz compresses to keep executable bit on the binary when extracted | |
# then prepares a directory to zip that file as github only supports zipped artifacts | |
run: | | |
mkdir artifact | |
tar -czvf "$ARTIFACT_NAME.tar.gz" "./$GAME_NAME.app" | |
mv "$ARTIFACT_NAME.tar.gz" ./artifact/ | |
- name: Store build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.ARTIFACT_NAME}} | |
path: artifact |