diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88b16ebc..04b77a26 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,13 @@ jobs: - name: Checkout Source uses: actions/checkout@v3 - - name: Run Build Commands + - name: Build Assets run: python setup.py qtlrelease sample manual - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: nw-assets-${{ github.sha }} + name: nw-assets path: | novelwriter/assets/sample.zip novelwriter/assets/manual.pdf @@ -34,6 +34,49 @@ jobs: if-no-files-found: error 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: needs: buildAssets strategy: @@ -46,30 +89,30 @@ jobs: - name: Get Version shell: bash run: | - NW_VERSION=`awk '/^__version__/{print substr($NF,2,length($NF)-2)}' novelwriter/__init__.py` - echo "novelWriter Version: $NW_VERSION" - echo "VERSION=$NW_VERSION" >> $GITHUB_ENV + NW_VER=$(python3 setup.py version) + echo "novelWriter Version: $NW_VER" + echo "VERSION=$NW_VER" >> $GITHUB_ENV - - name: Download Artifact + - name: Download Artifacts uses: actions/download-artifact@v3 with: - name: nw-assets-${{ github.sha }} + name: nw-assets path: novelwriter/assets - - name: Build - run: | - ./setup/macos/build.sh + - name: Build App Bundle + run: ./setup/macos/build.sh - - name: Upload ZIP + - name: Upload App Zip uses: actions/upload-artifact@v3 with: 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 - name: Upload DMG uses: actions/upload-artifact@v3 with: 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 diff --git a/docs/source/int_started.rst b/docs/source/int_started.rst index 3890d75f..7274e53b 100644 --- a/docs/source/int_started.rst +++ b/docs/source/int_started.rst @@ -106,6 +106,25 @@ completely standalone images for the app that include the necessary environment They can of course be run on any Linux distro, if you prefer this to native packages. +.. _a_started_macos: + +Install on MacOS +================ + +You can install novelWriter with both its Python and library dependencies embedded using the +DMG application image file from the `main website`_, or from the Releases_ page on GitHub. +Installing it should be straightforward. + +Download the DMG file and open it. Then drag the novelWriter icon to the Applications folder on +the right. This will install it into your Applications. The first time you try to launch it, it will +say that the bundle cannot be verified, simply press the “open” button to add an exception. +If you are not presented with an "open" button in the dialog launch the application again by +right clicking on the application in Finder and selecting "Open" from the context menu. + +The context menu can also be accessed by option clicking if you have a one button mouse. +This is done by holding down the option key on your keyboard and clicking on the application in Finder. + + .. _a_started_minimal: Minimal Package Install diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index e330d5ab..5c94c480 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -59,8 +59,8 @@ __license__ = "GPLv3" __author__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen" __email__ = "code@vkbo.net" -__version__ = "2.0.5" -__hexversion__ = "0x020005f0" +__version__ = "2.1-alpha0" +__hexversion__ = "0x020100a0" __date__ = "2023-02-12" __status__ = "Stable" __domain__ = "novelwriter.io" diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index feb7e7b0..2df0e5fa 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,6 +1,6 @@ - - + + Sample Project Sample Project Jane Smith diff --git a/setup.py b/setup.py index b54f3797..2734af6f 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ OS_DARWIN = 3 # Utilities # =============================================================================================== # -def extractVersion(): +def extractVersion(beQuiet=False): """Extract the novelWriter version number without having to import anything else from the main package. """ @@ -67,7 +67,8 @@ def extractVersion(): print("Could not read file: %s" % initFile) 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 @@ -935,7 +936,7 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False): ## def makeAppImage(sysArgs): - """Build an Appimage + """Build an Appimage. """ import glob import argparse @@ -1027,13 +1028,6 @@ def makeAppImage(sysArgs): except OSError: print("Error while deleting file : ", image) - # Build Additional Assets - # ======================= - - buildQtI18n() - buildSampleZip() - buildPdfManual() - # Copy novelWriter Source # ======================= @@ -1882,6 +1876,7 @@ if __name__ == "__main__": "", " help Print the help message.", " pip Install all package dependencies for novelWriter using pip.", + " version Print the novelWriter version.", " build-clean Will attempt to delete 'build' and 'dist' folders.", "", "Additional Builds:", @@ -1939,8 +1934,8 @@ if __name__ == "__main__": if "version" in sys.argv: sys.argv.remove("version") - print("Checking source version info ...") - extractVersion() + numVers, _, _ = extractVersion(beQuiet=True) + print(numVers, end=None) sys.exit(0) if "pip" in sys.argv: diff --git a/setup/macos/build.sh b/setup/macos/build.sh index e3e8e2ff..af92b5f5 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -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" @@ -42,6 +40,7 @@ else fi # 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 @@ -61,14 +60,16 @@ else exit 1 fi +echo "Content of current dir:" ls -lah . 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 @@ -82,13 +83,15 @@ source activate novelWriter echo "installing dictionaries ..." 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" -# leave conda env +# Leave conda env conda deactivate +# --- Build App --------------------------------------------------------------------------------- # + echo "Building app bundle ..." # create .app Framework mkdir -p novelWriter.app/Contents/ @@ -112,23 +115,26 @@ done 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 #!/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 -#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 @@ -152,20 +158,25 @@ rm lib/python3.*/site-packages/PyQt5/Qt/lib/libQt5WebEngine* || true popd || exit 1 popd || exit 1 +# --- 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 + +# --- 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"/