-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ae19f2
commit a8382be
Showing
6 changed files
with
159 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,7 +212,7 @@ jobs: | |
package-mac: | ||
runs-on: macos-11 | ||
name: Build and package for Mac OS | ||
name: Build and package for Mac OS (Intel) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
@@ -269,7 +269,7 @@ jobs: | |
- name: Upload .app | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: skytemple-mac-app | ||
name: skytemple-mac-app-x86_64 | ||
path: | | ||
installer/skytemple-mac.zip | ||
|
@@ -288,7 +288,92 @@ jobs: | |
- name: Upload .dmg | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: skytemple-mac-dmg | ||
name: skytemple-mac-dmg-x86_64 | ||
path: | | ||
installer/SkyTemple*.dmg | ||
package-mac-arm64: | ||
runs-on: macos-14 | ||
name: Build and package for Mac OS (ARM) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Rewrite version for dev if not tag | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
run: | | ||
perl -i -pe "s/version\s*=\s*\"(.*?)(\.rc.*|\.a.*|\.post.*)?\"/version=\"\1.dev0+${GITHUB_SHA::8}\"/" pyproject.toml | ||
echo "IS_DEV_BUILD=1" >> $GITHUB_ENV | ||
- name: Note version | ||
run: | | ||
python3 -m venv .yq-venv | ||
. .yq-venv/bin/activate | ||
pip install yq | ||
echo "PACKAGE_VERSION=$(tomlq '.project.version' pyproject.toml -r)" >> $GITHUB_ENV | ||
- name: Install and package | ||
run: | | ||
# git is already installed. | ||
brew install enchant pygobject3 gtk+3 [email protected] gtksourceview4 adwaita-icon-theme sdl12-compat sdl2 meson cmake | ||
pip3 install -U certifi | ||
export PATH=/usr/local/opt/[email protected]/bin:/usr/local/bin:/opt/homebrew/bin:$PATH | ||
# Install other dependencies and SkyTemple itself | ||
pip3 install py-desmume 'pyinstaller~=5.0' | ||
if [ -n "$IS_DEV_BUILD" ]; then | ||
IS_MACOS=1 installer/install-skytemple-rust.sh x86_64 | ||
fi | ||
pip3 install -r requirements-mac-windows.txt | ||
# Generate MO localization files | ||
installer/generate-mo.sh | ||
pip3 install '.[eventserver]' | ||
if [ -n "$IS_DEV_BUILD" ]; then | ||
installer/install-skytemple-components-from-git.sh | ||
fi | ||
cd installer | ||
# Install themes | ||
curl https://skytemple.org/build_deps/Arc.zip -O | ||
unzip Arc.zip > /dev/null | ||
curl https://skytemple.org/build_deps/ZorinBlue.zip -O | ||
unzip ZorinBlue.zip > /dev/null | ||
# Download armips | ||
curl https://skytemple.org/build_deps/mac/armips -O | ||
chmod +x armips | ||
# Package | ||
if [ "$(uname -m)" = "arm64" ]; then | ||
./build-mac-arm.sh $PACKAGE_VERSION | ||
else | ||
./build-mac.sh $PACKAGE_VERSION | ||
fi | ||
# Creating a zip makes the artifact upload much faster since there are so many files | ||
zip -r skytemple-mac.zip dist/SkyTemple.app > /dev/null | ||
- name: Upload .app | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: skytemple-mac-app-arm64 | ||
path: | | ||
installer/skytemple-mac.zip | ||
- name: Create installer | ||
run: | | ||
export PATH=/usr/local/opt/[email protected]/bin:/usr/local/bin:/opt/homebrew/bin:$PATH | ||
# See https://github.com/sindresorhus/create-dmg | ||
# create-dmg automatically generates an installer icon if imagemagick is installed | ||
brew install graphicsmagick imagemagick | ||
npm -g install create-dmg | ||
# This tool returns exit code 2 if the DMG was created but code signing failed for some reason | ||
npx create-dmg --dmg-title=SkyTemple installer/dist/SkyTemple.app installer || true | ||
- name: Upload .dmg | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: skytemple-mac-dmg-arm64 | ||
path: | | ||
installer/SkyTemple*.dmg | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Call with "PACKAGE_VERSION=[version number] ./build-mac.sh" | ||
# The version from the current pip install of SkyTemple is used if no version number is set. | ||
set -e | ||
|
||
generate_version_file() { | ||
location=$(pip3 show $1 | grep Location | cut -d":" -f 2 | cut -c2-) | ||
pip3 show $1 | grep Version | cut -d":" -f 2 | cut -c2- > $location/$1/VERSION | ||
} | ||
|
||
# The VERSION files for a few dependencies are missing for some reason, so generate them from 'pip show' commands | ||
generate_version_file cssselect2 | ||
generate_version_file tinycss2 | ||
generate_version_file cairosvg | ||
generate_version_file cairocffi | ||
|
||
# Create the icon | ||
# https://www.codingforentrepreneurs.com/blog/create-icns-icons-for-macos-apps | ||
mkdir skytemple.iconset | ||
icons_path=../skytemple/data/icons/hicolor | ||
cp $icons_path/16x16/apps/skytemple.png skytemple.iconset/icon_16x16.png | ||
cp $icons_path/32x32/apps/skytemple.png skytemple.iconset/[email protected] | ||
cp $icons_path/32x32/apps/skytemple.png skytemple.iconset/icon_32x32.png | ||
cp $icons_path/64x64/apps/skytemple.png skytemple.iconset/[email protected] | ||
cp $icons_path/128x128/apps/skytemple.png skytemple.iconset/icon_128x128.png | ||
cp $icons_path/256x256/apps/skytemple.png skytemple.iconset/[email protected] | ||
cp $icons_path/256x256/apps/skytemple.png skytemple.iconset/icon_256x256.png | ||
cp $icons_path/512x512/apps/skytemple.png skytemple.iconset/[email protected] | ||
cp $icons_path/512x512/apps/skytemple.png skytemple.iconset/icon_512x512.png | ||
|
||
iconutil -c icns skytemple.iconset | ||
rm -rf skytemple.iconset | ||
|
||
# Build the app | ||
pyinstaller skytemple-mac.spec --noconfirm | ||
rm skytemple.icns | ||
|
||
# Since the library search path for the app is wrong, execute a shell script that sets is correctly | ||
# and launches the app instead of launching run_skytemple directly | ||
appdir=dist/SkyTemple.app/Contents/MacOS |
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
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
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
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