Skip to content

Commit

Permalink
Rewrite macOS build workflow and make some changes to build script
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo committed Feb 4, 2023
1 parent 74ead29 commit 0e529fd
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 101 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/build.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Packaging

on:
push:
tags:
- "*"
pull_request:
branches:
- patch

jobs:
buildAssets:
runs-on: ubuntu-latest
steps:
- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: 3
architecture: x64

- name: Install Packages (apt)
run: |
sudo apt update
sudo apt install qttools5-dev-tools python3-sphinx latexmk texlive texlive-latex-extra
- name: Checkout Source
uses: actions/checkout@v3

- name: Run Build Commands
run: python setup.py qtlrelease sample manual

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: nw-assets-${{ github.sha }}
path: |
novelwriter/assets/sample.zip
novelwriter/assets/manual.pdf
novelwriter/assets/i18n/*.qm
if-no-files-found: error
retention-days: 1

buildMac:
needs: buildAssets
strategy:
fail-fast: false
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3

- 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
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: nw-assets-${{ github.sha }}
path: novelwriter/assets

- name: Build
run: |
./setup/macos/build.sh
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: novelWriter-${{ env.VERSION }}-macos.app.zip
path: dist_macos/novelWriter-${{ env.VERSION }}.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
retention-days: 1
32 changes: 29 additions & 3 deletions setup/macos/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,33 @@ VERSION="$(awk '/^__version__/{print substr($NF,2,length($NF)-2)}' $SRC_DIR/nove

pushd "$SRC_DIR" || exit 1

python3 setup.py manual qtlrelease sample gen-plist
python3 setup.py gen-plist
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
echo "Found: setup/macos/Info.plist"
else
echo "Missing: setup/macos/Info.plist"
exit 1
fi

# Check that other assets are present
if [ -f $SRC_DIR/novelwriter/assets/sample.zip ]; then
echo "Found: novelwriter/assets/sample.zip"
else
echo "Missing: novelwriter/assets/sample.zip"
exit 1
fi
if [ -f $SRC_DIR/novelwriter/assets/manual.pdf ]; then
echo "Found: novelwriter/assets/manual.pdf"
else
echo "Missing: novelwriter/assets/manual.pdf"
exit 1
fi
if [ -f $SRC_DIR/novelwriter/assets/i18n/nw_en_US.qm ]; then
echo "Found: novelwriter/assets/i18n/nw_en_US.qm"
else
echo "Missing: novelwriter/assets/i18n/nw_en_US.qm"
exit 1
fi

ls -lah .

Expand Down Expand Up @@ -78,7 +104,7 @@ echo "Copying novelWriter to bundle ..."

FILES_COPY=(
"CHANGELOG.md" "MANIFEST.in" "CREDITS.md" "LICENSE.md"
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "i18n" "novelwriter"
"CONTRIBUTING.md" "CODE_OF_CONDUCT.md" "novelwriter"
"novelWriter.py"
)

Expand Down Expand Up @@ -114,7 +140,7 @@ rm -rf pkgs
rm -rf cmake
rm -rf share/{gtk-,}doc

#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
Expand Down

0 comments on commit 0e529fd

Please sign in to comment.