Add M1 build for MacOS

This commit is contained in:
Veronica Berglyd Olsen
2024-04-20 17:41:10 +02:00
parent 5a202e96fd
commit b1d1af2153
2 changed files with 48 additions and 12 deletions
+30 -6
View File
@@ -9,7 +9,7 @@ jobs:
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
architecture: x64
- name: Install Packages (apt)
@@ -42,13 +42,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
linux-tag: ["manylinux_2_24_x86_64", "manylinux_2_28_x86_64"]
steps:
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
architecture: x64
- name: Install Packages (pip)
@@ -74,7 +74,7 @@ jobs:
if-no-files-found: error
retention-days: 1
buildMac:
buildMac-AMD64:
needs: buildAssets
runs-on: macos-12
steps:
@@ -88,12 +88,36 @@ jobs:
path: novelwriter/assets
- name: Build App Bundle
run: ./setup/macos/build.sh
run: ./setup/macos/build.sh amd64
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: MacOS-DMG
name: MacOS-AMD64-DMG
path: dist_macos
if-no-files-found: error
retention-days: 1
buildMac-M1:
needs: buildAssets
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: nw-assets
path: novelwriter/assets
- name: Build App Bundle
run: ./setup/macos/build.sh arm64
- name: Upload DMG
uses: actions/upload-artifact@v4
with:
name: MacOS-M1-DMG
path: dist_macos
if-no-files-found: error
retention-days: 1
+18 -6
View File
@@ -1,5 +1,17 @@
#! /bin/bash
if [ -z "$1"]; then
ARCH="amd64"
else
ARCH="$1"
fi
if [ $ARCH == "amd64 "]; then
CONDA="x86_64"
else
CONDA="$ARCH"
fi
# Use RAM disk if possible
if [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
@@ -76,9 +88,9 @@ pushd "$BUILD_DIR"/ || exit 1
# --- Create Miniconda Env ---------------------------------------------------------------------- #
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
curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$CONDA.sh
bash Miniconda3-latest-MacOSX-$CONDA.sh -b -p ~/miniconda -f
rm Miniconda3-latest-MacOSX-$CONDA.sh
export PATH="$HOME/miniconda/bin:$PATH"
echo "Creating Conda env ..."
@@ -123,7 +135,7 @@ cp $SRC_DIR/setup/macos/novelwriter.icns novelWriter.app/Contents/Resources/
# Create entry script
echo "Creating entry script ..."
cat > novelWriter.app/Contents/MacOS/novelWriter <<\EOF
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 $@
@@ -173,8 +185,8 @@ brew install create-dmg
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}"-amd64.dmg "$BUILD_DIR"/
--app-drop-link 600 185 $RLS_DIR/novelWriter-"${VERSION}"-$ARCH.dmg "$BUILD_DIR"/
pushd $RLS_DIR || exit 1
shasum -a 256 novelWriter-"${VERSION}"-amd64.dmg | tee novelWriter-"${VERSION}"-amd64.dmg.sha256
shasum -a 256 novelWriter-"${VERSION}"-$ARCH.dmg | tee novelWriter-"${VERSION}"-$ARCH.dmg.sha256
popd || exit 1