Skip to content

Commit

Permalink
upload macos app build artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Nov 21, 2023
1 parent e0c81f2 commit 4c15987
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 124 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,22 @@ jobs:
chmod +x create-dmg
- run: echo create-dmg >> $GITHUB_PATH
- name: macos-x64
run: ./build-osx-x64.sh
run: ./build-osx-x64.sh --build --dmg
- name: macos-aarch64
run: ./build-osx-aarch64.sh
run: ./build-osx-aarch64.sh --build --dmg
# tar app to keep permissions correct
- name: tar app
run: tar -cf app.tar build/macos-x64/RuneLite.app build/macos-aarch64/RuneLite.app build-osx-x64.sh build-osx-aarch64.sh osx/signing.entitlements
- uses: actions/upload-artifact@v3
with:
name: macos
name: macos-dmg
path: |
RuneLite-x64.dmg
RuneLite-aarch64.dmg
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: macos-app
path: |
app.tar
if-no-files-found: error
145 changes: 83 additions & 62 deletions build-osx-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,99 @@

set -e

SIGNING_IDENTITY="Developer ID Application"

pushd native
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -B build-aarch64 .
cmake --build build-aarch64 --config Release
popd

source .jdk-versions.sh

rm -rf build/macos-aarch64
mkdir -p build/macos-aarch64

if ! [ -f mac_aarch64_jre.tar.gz ] ; then
curl -Lo mac_aarch64_jre.tar.gz $MAC_AARCH64_LINK
fi

echo "$MAC_AARCH64_CHKSUM mac_aarch64_jre.tar.gz" | shasum -c
APPBASE="build/macos-aarch64/RuneLite.app"

# packr requires a "jdk" and pulls the jre from it - so we have to place it inside
# the jdk folder at jre/
if ! [ -d osx-aarch64-jdk ] ; then
tar zxf mac_aarch64_jre.tar.gz
mkdir osx-aarch64-jdk
mv jdk-$MAC_AARCH64_VERSION-jre osx-aarch64-jdk/jre

pushd osx-aarch64-jdk/jre
# Move JRE out of Contents/Home/
mv Contents/Home/* .
# Remove unused leftover folders
rm -rf Contents
build() {
pushd native
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -B build-aarch64 .
cmake --build build-aarch64 --config Release
popd
fi

APPBASE="build/macos-aarch64/RuneLite.app"
source .jdk-versions.sh

mkdir -p $APPBASE/Contents/{MacOS,Resources}
rm -rf build/macos-aarch64
mkdir -p build/macos-aarch64

cp native/build-aarch64/src/RuneLite $APPBASE/Contents/MacOS/
cp target/RuneLite.jar $APPBASE/Contents/Resources/
cp packr/macos-aarch64-config.json $APPBASE/Contents/Resources/config.json
cp target/filtered-resources/Info.plist $APPBASE/Contents/
cp osx/runelite.icns $APPBASE/Contents/Resources/icons.icns
if ! [ -f mac_aarch64_jre.tar.gz ] ; then
curl -Lo mac_aarch64_jre.tar.gz $MAC_AARCH64_LINK
fi

tar zxf mac_aarch64_jre.tar.gz
mkdir $APPBASE/Contents/Resources/jre
mv jdk-$MAC_AARCH64_VERSION-jre/Contents/Home/* $APPBASE/Contents/Resources/jre
echo "$MAC_AARCH64_CHKSUM mac_aarch64_jre.tar.gz" | shasum -c

echo Setting world execute permissions on RuneLite
pushd $APPBASE
chmod g+x,o+x Contents/MacOS/RuneLite
popd
# packr requires a "jdk" and pulls the jre from it - so we have to place it inside
# the jdk folder at jre/
if ! [ -d osx-aarch64-jdk ] ; then
tar zxf mac_aarch64_jre.tar.gz
mkdir osx-aarch64-jdk
mv jdk-$MAC_AARCH64_VERSION-jre osx-aarch64-jdk/jre

codesign -f -s "${SIGNING_IDENTITY}" --entitlements osx/signing.entitlements --options runtime $APPBASE || true
pushd osx-aarch64-jdk/jre
# Move JRE out of Contents/Home/
mv Contents/Home/* .
# Remove unused leftover folders
rm -rf Contents
popd
fi

# create-dmg exits with an error code due to no code signing, but is still okay
create-dmg $APPBASE . || true
mv RuneLite\ *.dmg RuneLite-aarch64.dmg
mkdir -p $APPBASE/Contents/{MacOS,Resources}

# dump for CI
hdiutil imageinfo RuneLite-aarch64.dmg
cp native/build-aarch64/src/RuneLite $APPBASE/Contents/MacOS/
cp target/RuneLite.jar $APPBASE/Contents/Resources/
cp packr/macos-aarch64-config.json $APPBASE/Contents/Resources/config.json
cp target/filtered-resources/Info.plist $APPBASE/Contents/
cp osx/runelite.icns $APPBASE/Contents/Resources/icons.icns

if ! hdiutil imageinfo RuneLite-aarch64.dmg | grep -q "Format: ULFO" ; then
echo Format of dmg is not ULFO
exit 1
fi
tar zxf mac_aarch64_jre.tar.gz
mkdir $APPBASE/Contents/Resources/jre
mv jdk-$MAC_AARCH64_VERSION-jre/Contents/Home/* $APPBASE/Contents/Resources/jre

if ! hdiutil imageinfo RuneLite-aarch64.dmg | grep -q "Apple_HFS" ; then
echo Filesystem of dmg is not Apple_HFS
exit 1
fi
echo Setting world execute permissions on RuneLite
pushd $APPBASE
chmod g+x,o+x Contents/MacOS/RuneLite
popd

# Notarize app
if xcrun notarytool submit RuneLite-aarch64.dmg --wait --keychain-profile "AC_PASSWORD" ; then
xcrun stapler staple RuneLite-aarch64.dmg
fi
otool -l $APPBASE/Contents/MacOS/RuneLite
}

dmg() {
SIGNING_IDENTITY="Developer ID Application"
codesign -f -s "${SIGNING_IDENTITY}" --entitlements osx/signing.entitlements --options runtime $APPBASE || true

# create-dmg exits with an error code due to no code signing, but is still okay
create-dmg $APPBASE . || true
mv RuneLite\ *.dmg RuneLite-aarch64.dmg

# dump for CI
hdiutil imageinfo RuneLite-aarch64.dmg

if ! hdiutil imageinfo RuneLite-aarch64.dmg | grep -q "Format: ULFO" ; then
echo Format of dmg is not ULFO
exit 1
fi

if ! hdiutil imageinfo RuneLite-aarch64.dmg | grep -q "Apple_HFS" ; then
echo Filesystem of dmg is not Apple_HFS
exit 1
fi

# Notarize app
if xcrun notarytool submit RuneLite-aarch64.dmg --wait --keychain-profile "AC_PASSWORD" ; then
xcrun stapler staple RuneLite-aarch64.dmg
fi
}

while test $# -gt 0; do
case "$1" in
--build)
build
shift
;;
--dmg)
dmg
shift
;;
*)
break
;;
esac
done
139 changes: 80 additions & 59 deletions build-osx-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,85 @@

set -e

SIGNING_IDENTITY="Developer ID Application"

pushd native
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -B build-x64 .
cmake --build build-x64 --config Release
popd

source .jdk-versions.sh

rm -rf build/macos-x64
mkdir -p build/macos-x64

if ! [ -f mac64_jre.tar.gz ] ; then
curl -Lo mac64_jre.tar.gz $MAC_AMD64_LINK
fi

echo "$MAC_AMD64_CHKSUM mac64_jre.tar.gz" | shasum -c

APPBASE="build/macos-x64/RuneLite.app"

mkdir -p $APPBASE/Contents/{MacOS,Resources}

cp native/build-x64/src/RuneLite $APPBASE/Contents/MacOS/
cp target/RuneLite.jar $APPBASE/Contents/Resources/
cp packr/macos-x64-config.json $APPBASE/Contents/Resources/config.json
cp target/filtered-resources/Info.plist $APPBASE/Contents/
cp osx/runelite.icns $APPBASE/Contents/Resources/icons.icns

tar zxf mac64_jre.tar.gz
mkdir $APPBASE/Contents/Resources/jre
mv jdk-$MAC_AMD64_VERSION-jre/Contents/Home/* $APPBASE/Contents/Resources/jre

echo Setting world execute permissions on RuneLite
pushd $APPBASE
chmod g+x,o+x Contents/MacOS/RuneLite
popd

codesign -f -s "${SIGNING_IDENTITY}" --entitlements osx/signing.entitlements --options runtime $APPBASE || true

# create-dmg exits with an error code due to no code signing, but is still okay
# note we use Adam-/create-dmg as upstream does not support UDBZ
create-dmg --format UDBZ $APPBASE . || true
mv RuneLite\ *.dmg RuneLite-x64.dmg

# dump for CI
hdiutil imageinfo RuneLite-x64.dmg

if ! hdiutil imageinfo RuneLite-x64.dmg | grep -q "Format: UDBZ" ; then
echo "Format of resulting dmg was not UDBZ, make sure your create-dmg has support for --format"
exit 1
fi

if ! hdiutil imageinfo RuneLite-x64.dmg | grep -q "Apple_HFS" ; then
echo Filesystem of dmg is not Apple_HFS
exit 1
fi

# Notarize app
if xcrun notarytool submit RuneLite-x64.dmg --wait --keychain-profile "AC_PASSWORD" ; then
xcrun stapler staple RuneLite-x64.dmg
fi
build() {
pushd native
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -B build-x64 .
cmake --build build-x64 --config Release
popd

source .jdk-versions.sh

rm -rf build/macos-x64
mkdir -p build/macos-x64

if ! [ -f mac64_jre.tar.gz ] ; then
curl -Lo mac64_jre.tar.gz $MAC_AMD64_LINK
fi

echo "$MAC_AMD64_CHKSUM mac64_jre.tar.gz" | shasum -c

mkdir -p $APPBASE/Contents/{MacOS,Resources}

cp native/build-x64/src/RuneLite $APPBASE/Contents/MacOS/
cp target/RuneLite.jar $APPBASE/Contents/Resources/
cp packr/macos-x64-config.json $APPBASE/Contents/Resources/config.json
cp target/filtered-resources/Info.plist $APPBASE/Contents/
cp osx/runelite.icns $APPBASE/Contents/Resources/icons.icns

tar zxf mac64_jre.tar.gz
mkdir $APPBASE/Contents/Resources/jre
mv jdk-$MAC_AMD64_VERSION-jre/Contents/Home/* $APPBASE/Contents/Resources/jre

echo Setting world execute permissions on RuneLite
pushd $APPBASE
chmod g+x,o+x Contents/MacOS/RuneLite
popd

otool -l $APPBASE/Contents/MacOS/RuneLite
}

dmg() {
SIGNING_IDENTITY="Developer ID Application"
codesign -f -s "${SIGNING_IDENTITY}" --entitlements osx/signing.entitlements --options runtime $APPBASE || true

# create-dmg exits with an error code due to no code signing, but is still okay
# note we use Adam-/create-dmg as upstream does not support UDBZ
create-dmg --format UDBZ $APPBASE . || true
mv RuneLite\ *.dmg RuneLite-x64.dmg

# dump for CI
hdiutil imageinfo RuneLite-x64.dmg

if ! hdiutil imageinfo RuneLite-x64.dmg | grep -q "Format: UDBZ" ; then
echo "Format of resulting dmg was not UDBZ, make sure your create-dmg has support for --format"
exit 1
fi

if ! hdiutil imageinfo RuneLite-x64.dmg | grep -q "Apple_HFS" ; then
echo Filesystem of dmg is not Apple_HFS
exit 1
fi

# Notarize app
if xcrun notarytool submit RuneLite-x64.dmg --wait --keychain-profile "AC_PASSWORD" ; then
xcrun stapler staple RuneLite-x64.dmg
fi
}

while test $# -gt 0; do
case "$1" in
--build)
build
shift
;;
--dmg)
dmg
shift
;;
*)
break
;;
esac
done

0 comments on commit 4c15987

Please sign in to comment.