Skip to content

Commit

Permalink
update osx workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
phnzb committed Dec 12, 2024
1 parent b0fde25 commit d0b249f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
workflow_call:
workflow_dispatch:

env:
BUILD_TYPES: ${{ (github.ref_name == 'develop' || github.ref_name == 'main') && 'release debug' || 'release debug' }}
BUILD_TESTING: ${{ (github.ref_name != 'main') && 'testing' || '' }}

jobs:
build-x64:
runs-on: [self-hosted, macos, x64]
Expand All @@ -14,12 +18,7 @@ jobs:
uses: actions/checkout@v4

- name: Build
run: |
if [ "$GITHUB_REF_NAME" != "main" ]; then
bash osx/build-nzbget.sh x64 testing
else
bash osx/build-nzbget.sh x64
fi
run: bash osx/build-nzbget.sh x64 ${{ env.BUILD_TYPES }} ${{ env.BUILD_TESTING }}

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
Expand All @@ -36,7 +35,7 @@ jobs:
SUFFIX="${GITHUB_REF_NAME/\//-}"
for FILE in *.zip; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/-bin-macos-x64.zip/-$SUFFIX-bin-macos-x64.zip}
NEW_FILE=${FILE/-bin-macos-x64/-$SUFFIX-bin-macos-x64}
mv $FILE $NEW_FILE
done
Expand All @@ -56,12 +55,7 @@ jobs:
uses: actions/checkout@v4

- name: Build
run: |
if [ "$GITHUB_REF_NAME" != "main" ]; then
bash osx/build-nzbget.sh universal testing
else
bash osx/build-nzbget.sh universal
fi
run: bash osx/build-nzbget.sh universal ${{ env.BUILD_TYPES }} ${{ env.BUILD_TESTING }}

- name: Upload full build log on failure
uses: actions/upload-artifact@v4
Expand All @@ -78,15 +72,15 @@ jobs:
SUFFIX="${GITHUB_REF_NAME/\//-}"
for FILE in *.zip; do
[ -f $FILE ] || continue
NEW_FILE=${FILE/-bin-macos-universal.zip/-$SUFFIX-bin-macos-universal.zip}
NEW_FILE=${FILE/-bin-macos-universal/-$SUFFIX-bin-macos-universal}
mv $FILE $NEW_FILE
done
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-osx-installers-universal
path: build/*-universal.zip
path: build/*-universal*.zip
retention-days: 5

sign-universal:
Expand Down
14 changes: 6 additions & 8 deletions osx/build-nzbget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ fi
# version handling
VERSION=$(grep "set(VERSION " CMakeLists.txt | cut -d '"' -f 2)
VERSION_SUFFIX=""
if [ $# -gt 1 ]; then
if [ "$2" == "testing" ]; then
VERSION_SUFFIX="-testing-$(date '+%Y%m%d')"
fi
if [ "$TESTING" == "yes" ]; then
VERSION_SUFFIX="-testing-$(date '+%Y%m%d')"
fi

# create directories and cleanup
Expand All @@ -84,7 +82,7 @@ rm -rf build/*
NZBGET_ROOT=$PWD
for CONFIG in $CONFIGS; do
for ARCH in $ARCHS; do

echo "Make $ARCH nzbget package..."
cd $NZBGET_ROOT

Expand Down Expand Up @@ -129,14 +127,14 @@ for CONFIG in $CONFIGS; do
-DVERSION_SUFFIX="$VERSION_SUFFIX" \
-DCMAKE_SYSTEM_PROCESSOR=$CMAKE_ARCH \
-DCMAKE_OSX_ARCHITECTURES=$CMAKE_ARCH

BUILD_STATUS=""
cmake --build . -j $JOBS 2>build.log || BUILD_STATUS=$?
if [ ! -z $BUILD_STATUS ]; then
tail -20 build.log
exit 1
fi

strip nzbget
cmake --install . >/dev/null
cmake --build . --target install-conf
Expand Down Expand Up @@ -218,7 +216,7 @@ for CONFIG in $CONFIGS; do
DAEMON_PATH=Contents/Resources/daemon/usr/local/bin/
# nzbget universal binary
lipo -create NZBGet.x64.app/$DAEMON_PATH/nzbget NZBGet.arm64.app/$DAEMON_PATH/nzbget -output nzbget
# unrar universal binary
# unrar universal binary
lipo -create NZBGet.x64.app/$DAEMON_PATH/unrar NZBGet.arm64.app/$DAEMON_PATH/unrar -output unrar
rm -rf NZBGet.x64.app
mv NZBGet.arm64.app NZBGet.app
Expand Down

0 comments on commit d0b249f

Please sign in to comment.