Clean up Mac build a bit

This commit is contained in:
Veronica Berglyd Olsen
2023-04-18 18:44:08 +02:00
parent 96bed5b3d5
commit 9daf1f1ca0
2 changed files with 15 additions and 21 deletions
+4 -6
View File
@@ -83,8 +83,6 @@ jobs:
buildMac:
needs: buildAssets
strategy:
fail-fast: false
runs-on: macos-12
steps:
- name: Checkout
@@ -109,14 +107,14 @@ jobs:
- name: Upload App Zip
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.app.zip
path: dist_macos/novelWriter-${{ env.VERSION }}-macos.app.zip
name: novelWriter-${{ env.VERSION }}.app.zip
path: dist_macos/novelWriter-*.app.zip
retention-days: 1
- name: Upload DMG
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.dmg
path: dist_macos/novelWriter-${{ env.VERSION }}-macos.dmg
name: novelWriter-${{ env.VERSION }}.dmg
path: dist_macos/novelWriter-*.dmg
if-no-files-found: error
retention-days: 1
+11 -15
View File
@@ -12,8 +12,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR="$SCRIPT_DIR/../.."
RLS_DIR="$SRC_DIR/dist_macos"
echo "Script Dir: $SCRIPT_DIR"
cleanup () {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
@@ -21,14 +19,14 @@ cleanup () {
}
trap cleanup EXIT
echo "Script Dir: $SCRIPT_DIR"
echo "Building in: $BUILD_DIR"
OLD_CWD="$(pwd)"
VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/novelwriter/__init__.py)"
# --- Prepare Files ----------------------------------------------------------------------------- #
pushd "$SRC_DIR" || exit 1
# --- Prepare Files ----------------------------------------------------------------------------- #
VERSION="$(python3 setup.py version)"
echo "Generating Info.plist"
python3 setup.py gen-plist
@@ -68,7 +66,6 @@ pushd "$BUILD_DIR"/ || exit 1
# --- Create Miniconda Env ---------------------------------------------------------------------- #
# install Miniconda, a self-contained Python distribution
echo "Downloading Miniconda ..."
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/miniconda -f
@@ -76,7 +73,7 @@ rm Miniconda3-latest-MacOSX-x86_64.sh
export PATH="$HOME/miniconda/bin:$PATH"
echo "Creating conda env ..."
# create conda env
conda create -n novelWriter -c conda-forge python=3.10 --yes
source activate novelWriter
@@ -93,7 +90,8 @@ conda deactivate
# --- Build App --------------------------------------------------------------------------------- #
echo "Building app bundle ..."
# create .app Framework
# Create .app Framework
mkdir -p novelWriter.app/Contents/
mkdir novelWriter.app/Contents/MacOS novelWriter.app/Contents/Resources novelWriter.app/Contents/Resources/novelWriter
cp $SRC_DIR/setup/macos/Info.plist novelWriter.app/Contents/Info.plist
@@ -130,13 +128,12 @@ chmod a+x novelWriter.app/Contents/MacOS/novelWriter
# echo "Signing bundle ..."
# sudo codesign --sign - --deep --force --entitlements "$SCRIPT_DIR/../macos/App.entitlements" --options runtime "novelWriter.app/Contents/MacOS/novelWriter"
# Remove bloat
pushd novelWriter.app/Contents/Resources || exit 1
# --- Cleanup ----------------------------------------------------------------------------------- #
echo "Cleaning unused files from bundle ..."
# cleanup commands HERE
pushd novelWriter.app/Contents/Resources || exit 1
find . -type d -iname '__pycache__' -print0 | xargs -0 rm -r
rm -rf pkgs
@@ -146,7 +143,7 @@ rm -rf share/{gtk-,}doc
# Remove the files from the 3.1 symlink
rm -rf lib/python3.1
# remove web engine
# Remove web engine
rm lib/python3.*/site-packages/PyQt5/QtWebEngine* || true
rm -r lib/python3.*/site-packages/PyQt5/Qt/translations/qtwebengine* || true
rm lib/python3.*/site-packages/PyQt5/Qt/resources/qtwebengine* || true
@@ -167,7 +164,7 @@ pushd $BUILD_DIR || exit 1
zip -qr novelWriter.app.zip novelWriter.app
popd || exit 1
mv -v $BUILD_DIR/novelWriter.app.zip $RLS_DIR/novelWriter-"${VERSION}"-macos.app.zip
mv -v $BUILD_DIR/novelWriter.app.zip $RLS_DIR/novelWriter-"${VERSION}".app.zip
# --- Create DMG -------------------------------------------------------------------------------- #
@@ -175,8 +172,7 @@ mv -v $BUILD_DIR/novelWriter.app.zip $RLS_DIR/novelWriter-"${VERSION}"-macos.app
echo "Packageing DMG ..."
brew install create-dmg
# "--skip-jenkins" is a temporary workaround for https://github.com/create-dmg/create-dmg/issues/72
create-dmg --volname "novelWriter $VERSION" --volicon $SRC_DIR/setup/macos/novelwriter.icns \
--window-pos 200 120 --window-size 800 400 --icon-size 100 \
--icon novelWriter.app 200 190 --hide-extension novelWriter.app \
--app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-macos.dmg "$BUILD_DIR"/
--app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}".dmg "$BUILD_DIR"/