diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml new file mode 100644 index 00000000..cd6e0acb --- /dev/null +++ b/.github/workflows/bundle.yml @@ -0,0 +1,39 @@ +# bundle.yml +# Reusable workflow that builds the MacOS app bundle. +--- +name: bundle + +on: + workflow_call: + inputs: + version: + type: string + description: 'Version number' + required: true + +env: + FILE_NAME: "Libation.${{ inputs.version }}-macos-chardonnay" + +jobs: + build_bundle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: "${{ env.FILE_NAME }}.tar.gz" + + - name: Build .app bundle + id: bundle + run: | + chmod +rwx ./Scripts/targz2bundle.sh + ./Scripts/targz2bundle.sh "${{ env.FILE_NAME }}.tar.gz" ${{ inputs.version }} + + - name: Publish .app bundle + uses: actions/upload-artifact@v3 + with: + name: "Libation.app-${{ inputs.version }}.tar.gz" + path: "Libation.app-${{ inputs.version }}.tar.gz" + if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29888cd9..0e164a97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,9 +39,15 @@ jobs: uses: ./.github/workflows/deb.yml with: version: ${{ needs.prerelease.outputs.version }} + + bundle: + needs: [prerelease,build] + uses: ./.github/workflows/bundle.yml + with: + version: ${{ needs.prerelease.outputs.version }} release: - needs: [prerelease,build,deb] + needs: [prerelease,build,deb,bundle] runs-on: ubuntu-latest steps: - name: Download artifacts diff --git a/Scripts/targz2bundle.sh b/Scripts/targz2bundle.sh new file mode 100644 index 00000000..4d59cc9a --- /dev/null +++ b/Scripts/targz2bundle.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +FILE=$1; shift +VERSION=$1; shift + +if [ -z "$FILE" ] +then + echo "This script must be called with a the Libation macos bin zip file as an argument." + exit +fi + +if [ ! -f "$FILE" ] +then + echo "The file \"$FILE\" does not exist." + exit +fi + +if [ -z "$VERSION" ] +then + echo "This script must be called with the Libation version number as an argument." + exit +fi + +contains() { case "$1" in *"$2"*) true ;; *) false ;; esac } + +if ! contains "$FILE" "$VERSION" +then + echo "This script must be called with a Libation version number that is present in the filename passed." + exit +fi + +# remove trailing ".tar.gz" +BUNDLE="Libation.app" +echo "Bundle dir: $BUNDLE" + +if [[ -d "$BUNDLE" ]] +then + echo "$BUNDLE directory already exists, aborting." + exit +fi + +BUNDLE_CONTENTS="$BUNDLE/Contents" +echo "Bundle Contents dir: $BUNDLE_CONTENTS" + +BUNDLE_RESOURCES="$BUNDLE_CONTENTS/Resources" +echo "Resources dir: $BUNDLE_RESOURCES" + +BUNDLE_MACOS="$BUNDLE_CONTENTS/MacOS" +echo "MacOS dir: $BUNDLE_MACOS" + +mkdir -p "$BUNDLE_CONTENTS" +mkdir -p "$BUNDLE_RESOURCES" +mkdir -p "$BUNDLE_MACOS" + +echo "Extracting $FILE to $BUNDLE_MACOS..." +tar -xzf ${FILE} -C ${BUNDLE_MACOS} + +if [ $? -ne 0 ] + then echo "Error extracting ${FILE}" + exit +fi + +echo "Copying icon..." +cp "$BUNDLE_MACOS/libation.icns" "$BUNDLE_RESOURCES/libation.icns" + +echo "Copying Info.plist file..." +cp "$BUNDLE_MACOS/Info.plist" "$BUNDLE_CONTENTS/Info.plist" + +echo "Set Libation version number..." +sed -i -e "s/VERSION_STRING/$VERSION/" "$BUNDLE_CONTENTS/Info.plist" + +echo "deleting unneeded files.." +delfiles=("libmp3lame.x64.so" "ffmpegaac.x64.so" "Libation.desktop" "libation.icns" "Info.plist" "glass-with-glow_256.svg") +for n in "${delfiles[@]}"; do rm "$BUNDLE_MACOS/$n"; done + +echo "Creating app bundle: $BUNDLE-$VERSION.tar.gz" +tar -czvf "$BUNDLE-$VERSION.tar.gz" "$BUNDLE" + +rm -r "$BUNDLE" + +echo "Done!" diff --git a/Source/LibationAvalonia/Info.plist b/Source/LibationAvalonia/Info.plist new file mode 100644 index 00000000..c88f1c80 --- /dev/null +++ b/Source/LibationAvalonia/Info.plist @@ -0,0 +1,27 @@ + + + + + + CFBundleExecutable + Libation + CFBundleName + Libation + CFBundleIdentifier + org.libation.macos + NSHighResolutionCapable + + CFBundleIconFile + libation.icns + CFBundleVersion + VERSION_STRING + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.disable-executable-page-protection + + + \ No newline at end of file diff --git a/Source/LibationAvalonia/LibationAvalonia.csproj b/Source/LibationAvalonia/LibationAvalonia.csproj index 0d324e4b..4ac37e7a 100644 --- a/Source/LibationAvalonia/LibationAvalonia.csproj +++ b/Source/LibationAvalonia/LibationAvalonia.csproj @@ -121,9 +121,15 @@ Always + + Always + Always + + Always + Always diff --git a/Source/LibationAvalonia/libation.icns b/Source/LibationAvalonia/libation.icns new file mode 100644 index 00000000..d2810d35 Binary files /dev/null and b/Source/LibationAvalonia/libation.icns differ