Merge branch 'patch'
This commit is contained in:
+56
-14
@@ -20,13 +20,13 @@ jobs:
|
|||||||
- name: Checkout Source
|
- name: Checkout Source
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Run Build Commands
|
- name: Build Assets
|
||||||
run: python setup.py qtlrelease sample manual
|
run: python setup.py qtlrelease sample manual
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: nw-assets-${{ github.sha }}
|
name: nw-assets
|
||||||
path: |
|
path: |
|
||||||
novelwriter/assets/sample.zip
|
novelwriter/assets/sample.zip
|
||||||
novelwriter/assets/manual.pdf
|
novelwriter/assets/manual.pdf
|
||||||
@@ -34,6 +34,49 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
buildLinux:
|
||||||
|
needs: buildAssets
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
LINUX_TAG: "manylinux_2_28_x86_64"
|
||||||
|
PY_VER: "3.10"
|
||||||
|
steps:
|
||||||
|
- name: Python Setup
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3
|
||||||
|
architecture: x64
|
||||||
|
|
||||||
|
- name: Install Packages (pip)
|
||||||
|
run: pip install python-appimage
|
||||||
|
|
||||||
|
- name: Checkout Source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
NW_VER=$(python setup.py version)
|
||||||
|
echo "novelWriter Version: $NW_VER"
|
||||||
|
echo "VERSION=$NW_VER" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nw-assets
|
||||||
|
path: novelwriter/assets
|
||||||
|
|
||||||
|
- name: Build AppImage
|
||||||
|
run: python setup.py build-appimage --linux-tag ${{ env.LINUX_TAG }} --python-version ${{ env.PY_VER }}
|
||||||
|
|
||||||
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: novelWriter-${{ env.VERSION }}-py${{ env.PY_VER }}-${{ env.LINUX_TAG }}.AppImage
|
||||||
|
path: dist_appimage/novelWriter-${{ env.VERSION }}-py${{ env.PY_VER }}-${{ env.LINUX_TAG }}.AppImage
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
buildMac:
|
buildMac:
|
||||||
needs: buildAssets
|
needs: buildAssets
|
||||||
strategy:
|
strategy:
|
||||||
@@ -46,31 +89,30 @@ jobs:
|
|||||||
- name: Get Version
|
- name: Get Version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
NW_VERSION=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py`
|
NW_VER=$(python3 setup.py version)
|
||||||
echo "novelWriter Version: $NW_VERSION"
|
echo "novelWriter Version: $NW_VER"
|
||||||
echo "VERSION=$NW_VERSION" >> $GITHUB_ENV
|
echo "VERSION=$NW_VER" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: nw-assets-${{ github.sha }}
|
name: nw-assets
|
||||||
path: novelwriter/assets
|
path: novelwriter/assets
|
||||||
|
|
||||||
- name: Build
|
- name: Build App Bundle
|
||||||
run: |
|
run: ./setup/macos/build.sh
|
||||||
./setup/macos/build.sh
|
|
||||||
|
|
||||||
- name: Upload ZIP
|
- name: Upload App Zip
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: novelWriter-${{ env.VERSION }}-macos.app.zip
|
name: novelWriter-${{ env.VERSION }}-macos.app.zip
|
||||||
path: dist_macos/novelWriter-${{ env.VERSION }}.app.zip
|
path: dist_macos/novelWriter-${{ env.VERSION }}-macos.app.zip
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
- name: Upload DMG
|
- name: Upload DMG
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: novelWriter-${{ env.VERSION }}-macos.dmg
|
name: novelWriter-${{ env.VERSION }}-macos.dmg
|
||||||
path: dist_macos/novelWriter-${{ env.VERSION }}.dmg
|
path: dist_macos/novelWriter-${{ env.VERSION }}-macos.dmg
|
||||||
|
if-no-files-found: error
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ OS_DARWIN = 3
|
|||||||
# Utilities
|
# Utilities
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
def extractVersion():
|
def extractVersion(beQuiet=False):
|
||||||
"""Extract the novelWriter version number without having to import
|
"""Extract the novelWriter version number without having to import
|
||||||
anything else from the main package.
|
anything else from the main package.
|
||||||
"""
|
"""
|
||||||
@@ -67,7 +67,8 @@ def extractVersion():
|
|||||||
print("Could not read file: %s" % initFile)
|
print("Could not read file: %s" % initFile)
|
||||||
print(str(exc))
|
print(str(exc))
|
||||||
|
|
||||||
print("novelWriter version: %s (%s) at %s" % (numVers, hexVers, relDate))
|
if not beQuiet:
|
||||||
|
print("novelWriter version: %s (%s) at %s" % (numVers, hexVers, relDate))
|
||||||
|
|
||||||
return numVers, hexVers, relDate
|
return numVers, hexVers, relDate
|
||||||
|
|
||||||
@@ -935,7 +936,7 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def makeAppImage(sysArgs):
|
def makeAppImage(sysArgs):
|
||||||
"""Build an Appimage
|
"""Build an Appimage.
|
||||||
"""
|
"""
|
||||||
import glob
|
import glob
|
||||||
import argparse
|
import argparse
|
||||||
@@ -1027,13 +1028,6 @@ def makeAppImage(sysArgs):
|
|||||||
except OSError:
|
except OSError:
|
||||||
print("Error while deleting file : ", image)
|
print("Error while deleting file : ", image)
|
||||||
|
|
||||||
# Build Additional Assets
|
|
||||||
# =======================
|
|
||||||
|
|
||||||
buildQtI18n()
|
|
||||||
buildSampleZip()
|
|
||||||
buildPdfManual()
|
|
||||||
|
|
||||||
# Copy novelWriter Source
|
# Copy novelWriter Source
|
||||||
# =======================
|
# =======================
|
||||||
|
|
||||||
@@ -1882,6 +1876,7 @@ if __name__ == "__main__":
|
|||||||
"",
|
"",
|
||||||
" help Print the help message.",
|
" help Print the help message.",
|
||||||
" pip Install all package dependencies for novelWriter using pip.",
|
" pip Install all package dependencies for novelWriter using pip.",
|
||||||
|
" version Print the novelWriter version.",
|
||||||
" build-clean Will attempt to delete 'build' and 'dist' folders.",
|
" build-clean Will attempt to delete 'build' and 'dist' folders.",
|
||||||
"",
|
"",
|
||||||
"Additional Builds:",
|
"Additional Builds:",
|
||||||
@@ -1939,8 +1934,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if "version" in sys.argv:
|
if "version" in sys.argv:
|
||||||
sys.argv.remove("version")
|
sys.argv.remove("version")
|
||||||
print("Checking source version info ...")
|
numVers, _, _ = extractVersion(beQuiet=True)
|
||||||
extractVersion()
|
print(numVers, end=None)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if "pip" in sys.argv:
|
if "pip" in sys.argv:
|
||||||
|
|||||||
+38
-27
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# use RAM disk if possible
|
# Use RAM disk if possible
|
||||||
if [ -d /dev/shm ]; then
|
if [ -d /dev/shm ]; then
|
||||||
TEMP_BASE=/dev/shm
|
TEMP_BASE=/dev/shm
|
||||||
else
|
else
|
||||||
@@ -8,11 +8,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
BUILD_DIR=$(mktemp -d "$TEMP_BASE/novelWriter-build-XXXXXX")
|
BUILD_DIR=$(mktemp -d "$TEMP_BASE/novelWriter-build-XXXXXX")
|
||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
SRC_DIR="$SCRIPT_DIR/../.."
|
SRC_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
RLS_DIR="$SRC_DIR/dist_macos"
|
RLS_DIR="$SRC_DIR/dist_macos"
|
||||||
|
|
||||||
echo "Script Dir: $SCRIPT_DIR"
|
echo "Script Dir: $SCRIPT_DIR"
|
||||||
@@ -22,17 +19,18 @@ cleanup () {
|
|||||||
rm -rf "$BUILD_DIR"
|
rm -rf "$BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
echo "Building in: $BUILD_DIR"
|
echo "Building in: $BUILD_DIR"
|
||||||
|
|
||||||
OLD_CWD="$(pwd)"
|
OLD_CWD="$(pwd)"
|
||||||
|
|
||||||
VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/novelwriter/__init__.py)"
|
VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/novelwriter/__init__.py)"
|
||||||
|
|
||||||
pushd "$SRC_DIR" || exit 1
|
pushd "$SRC_DIR" || exit 1
|
||||||
|
|
||||||
|
# --- Prepare Files ----------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
echo "Generating Info.plist"
|
||||||
python3 setup.py gen-plist
|
python3 setup.py gen-plist
|
||||||
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
|
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
|
||||||
echo "Found: setup/macos/Info.plist"
|
echo "Found: setup/macos/Info.plist"
|
||||||
@@ -42,6 +40,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that other assets are present
|
# Check that other assets are present
|
||||||
|
echo "Checking assets"
|
||||||
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
|
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
|
||||||
echo "Found: novelwriter/assets/sample.zip"
|
echo "Found: novelwriter/assets/sample.zip"
|
||||||
else
|
else
|
||||||
@@ -61,14 +60,16 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Content of current dir:"
|
||||||
ls -lah .
|
ls -lah .
|
||||||
|
|
||||||
popd || exit 1
|
popd || exit 1
|
||||||
|
|
||||||
pushd "$BUILD_DIR"/ || exit 1
|
pushd "$BUILD_DIR"/ || exit 1
|
||||||
|
|
||||||
echo "Downloading Miniconda ..."
|
# --- Create Miniconda Env ---------------------------------------------------------------------- #
|
||||||
|
|
||||||
# install Miniconda, a self-contained Python distribution
|
# install Miniconda, a self-contained Python distribution
|
||||||
|
echo "Downloading Miniconda ..."
|
||||||
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
|
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/miniconda -f
|
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/miniconda -f
|
||||||
rm Miniconda3-latest-MacOSX-x86_64.sh
|
rm Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
@@ -82,13 +83,15 @@ source activate novelWriter
|
|||||||
echo "installing dictionaries ..."
|
echo "installing dictionaries ..."
|
||||||
conda install -c conda-forge enchant hunspell-en --yes
|
conda install -c conda-forge enchant hunspell-en --yes
|
||||||
|
|
||||||
echo "installing python deps ..."
|
# Install dependencies
|
||||||
# install dependencies
|
echo "installing python dependencies ..."
|
||||||
pip install -r "$SRC_DIR/requirements.txt"
|
pip install -r "$SRC_DIR/requirements.txt"
|
||||||
|
|
||||||
# leave conda env
|
# Leave conda env
|
||||||
conda deactivate
|
conda deactivate
|
||||||
|
|
||||||
|
# --- Build App --------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
echo "Building app bundle ..."
|
echo "Building app bundle ..."
|
||||||
# create .app Framework
|
# create .app Framework
|
||||||
mkdir -p novelWriter.app/Contents/
|
mkdir -p novelWriter.app/Contents/
|
||||||
@@ -112,23 +115,26 @@ done
|
|||||||
|
|
||||||
cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/
|
cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/
|
||||||
|
|
||||||
# create entry script
|
# Create entry script
|
||||||
|
echo "Creating entry script ..."
|
||||||
cat > novelWriter.app/Contents/MacOS/novelWriter <<\EOF
|
cat > novelWriter.app/Contents/MacOS/novelWriter <<\EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@
|
$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py $@
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# make executable
|
# Make it executable
|
||||||
chmod a+x novelWriter.app/Contents/MacOS/novelWriter
|
chmod a+x novelWriter.app/Contents/MacOS/novelWriter
|
||||||
|
|
||||||
#do codesigning
|
# Do codesigning
|
||||||
#echo "Signing bundle ..."
|
# echo "Signing bundle ..."
|
||||||
#sudo codesign --sign - --deep --force --entitlements "$SCRIPT_DIR/../macos/App.entitlements" --options runtime "novelWriter.app/Contents/MacOS/novelWriter"
|
# 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
|
pushd novelWriter.app/Contents/Resources || exit 1
|
||||||
|
|
||||||
|
# --- Cleanup ----------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
echo "Cleaning unused files from bundle ..."
|
echo "Cleaning unused files from bundle ..."
|
||||||
# cleanup commands HERE
|
# cleanup commands HERE
|
||||||
find . -type d -iname '__pycache__' -print0 | xargs -0 rm -r
|
find . -type d -iname '__pycache__' -print0 | xargs -0 rm -r
|
||||||
@@ -152,20 +158,25 @@ rm lib/python3.*/site-packages/PyQt5/Qt/lib/libQt5WebEngine* || true
|
|||||||
popd || exit 1
|
popd || exit 1
|
||||||
popd || exit 1
|
popd || exit 1
|
||||||
|
|
||||||
|
# --- Create App Bundle-------------------------------------------------------------------------- #
|
||||||
|
|
||||||
echo "Packageing App ..."
|
echo "Packageing App ..."
|
||||||
|
|
||||||
mkdir -p $RLS_DIR
|
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
|
pushd $BUILD_DIR || exit 1
|
||||||
zip -qr novelWriter.app.zip novelWriter.app
|
zip -qr novelWriter.app.zip novelWriter.app
|
||||||
popd || exit 1
|
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
|
||||||
|
|
||||||
|
# --- 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"/
|
||||||
|
|||||||
Reference in New Issue
Block a user