Add MacOS app bundle workflow

This commit is contained in:
Michael Bucari-Tovo 2023-02-11 21:18:21 -07:00
parent 0fb580f1a5
commit 3bca495521
6 changed files with 160 additions and 1 deletions

39
.github/workflows/bundle.yml vendored Normal file
View File

@ -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

View File

@ -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

81
Scripts/targz2bundle.sh Normal file
View File

@ -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!"

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Libation</string>
<key>CFBundleName</key>
<string>Libation</string>
<key>CFBundleIdentifier</key>
<string>org.libation.macos</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleIconFile</key>
<string>libation.icns</string>
<key>CFBundleVersion</key>
<string>VERSION_STRING</string>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>

View File

@ -121,9 +121,15 @@
<None Update="glass-with-glow_256.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Info.plist">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Libation.desktop">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="libation.icns">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ZipExtractor.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

Binary file not shown.