Change order of macos build, and add more output

This commit is contained in:
Veronica Berglyd Olsen
2023-02-12 22:11:32 +01:00
parent 0b9ba78fac
commit d71a277af7
2 changed files with 52 additions and 29 deletions
+2 -2
View File
@@ -65,11 +65,11 @@ jobs:
with:
name: novelWriter-${{ env.VERSION }}-macos.app.zip
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
# retention-days: 1
retention-days: 1
- name: Upload DMG
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.dmg
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
# retention-days: 1
retention-days: 1
+50 -27
View File
@@ -1,6 +1,6 @@
#! /bin/bash
# use RAM disk if possible
# Use RAM disk if possible
if [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
@@ -8,11 +8,8 @@ else
fi
BUILD_DIR=$(mktemp -d "$TEMP_BASE/novelWriter-build-XXXXXX")
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"
@@ -22,17 +19,18 @@ cleanup () {
rm -rf "$BUILD_DIR"
fi
}
trap cleanup EXIT
echo "Building in: $BUILD_DIR"
OLD_CWD="$(pwd)"
VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/novelwriter/__init__.py)"
pushd "$SRC_DIR" || exit 1
# --- Prepare Files ----------------------------------------------------------------------------- #
echo "Generating Info.plist"
python3 setup.py gen-plist
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
echo "Found: setup/macos/Info.plist"
@@ -40,8 +38,10 @@ else
echo "Missing: setup/macos/Info.plist"
exit 1
fi
echo ""
# Check that other assets are present
echo "Checking assets"
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
echo "Found: novelwriter/assets/sample.zip"
else
@@ -60,40 +60,51 @@ else
echo "Missing: novelwriter/assets/i18n/nw_en_US.qm"
exit 1
fi
echo ""
echo "Content of current dir:"
ls -lah .
echo ""
popd || exit 1
pushd "$BUILD_DIR"/ || exit 1
echo "Downloading Miniconda ..."
# --- 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
rm Miniconda3-latest-MacOSX-x86_64.sh
export PATH="$HOME/miniconda/bin:$PATH"
echo ""
echo "Creating conda env ..."
# create conda env
conda create -n novelWriter -c conda-forge python=3.10 --yes
source activate novelWriter
echo ""
echo "installing dictionaries ..."
conda install -c conda-forge enchant hunspell-en --yes
echo ""
echo "installing python deps ..."
# install dependencies
# Install dependencies
echo "installing python dependencies ..."
pip install -r "$SRC_DIR/requirements.txt"
# leave conda env
# Leave conda env
conda deactivate
echo ""
# --- Build App --------------------------------------------------------------------------------- #
echo "Building app bundle ..."
# 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
echo ""
echo "Copying miniconda env to bundle ..."
cp -R ~/miniconda/envs/novelWriter/* novelWriter.app/Contents/Resources/
@@ -111,24 +122,29 @@ for file in "${FILES_COPY[@]}"; do
done
cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/
echo ""
# create entry script
# Create entry script
echo "Creating entry script ..."
cat > novelWriter.app/Contents/MacOS/novelWriter <<\EOF
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@
EOF
# make executable
# Make it executable
chmod a+x novelWriter.app/Contents/MacOS/novelWriter
echo ""
#do codesigning
#echo "Signing bundle ..."
#sudo codesign --sign - --deep --force --entitlements "$SCRIPT_DIR/../macos/App.entitlements" --options runtime "novelWriter.app/Contents/MacOS/novelWriter"
# Do codesigning
# echo "Signing bundle ..."
# sudo codesign --sign - --deep --force --entitlements "$SCRIPT_DIR/../macos/App.entitlements" --options runtime "novelWriter.app/Contents/MacOS/novelWriter"
# remove bloat
# Remove bloat
pushd novelWriter.app/Contents/Resources || exit 1
# --- Cleanup ----------------------------------------------------------------------------------- #
echo "Cleaning unused files from bundle ..."
# cleanup commands HERE
find . -type d -iname '__pycache__' -print0 | xargs -0 rm -r
@@ -151,21 +167,28 @@ rm lib/python3.*/site-packages/PyQt5/Qt/lib/libQt5WebEngine* || true
popd || exit 1
popd || exit 1
echo ""
# --- Create App Bundle-------------------------------------------------------------------------- #
echo "Packageing App ..."
mkdir -p $RLS_DIR
# generate .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}".dmg "$BUILD_DIR"/
pushd $BUILD_DIR || exit 1
zip -qr novelWriter.app.zip novelWriter.app
popd || exit 1
mv $BUILD_DIR/novelWriter.app.zip $RLS_DIR/novelWriter-"${VERSION}".app.zip
mv -v $BUILD_DIR/novelWriter.app.zip $RLS_DIR/novelWriter-"${VERSION}"-macos.app.zip
echo ""
# --- Create DMG -------------------------------------------------------------------------------- #
# Generate .dmg
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"/