mirror of
https://github.com/Felitendo/spotifast.git
synced 2026-11-01 17:33:26 +01:00
A version with a suffix, 0.4.0-rc1, tripped three things: the update check took it for nonsense and would never have told a candidate's users about the release; Inno Setup's file version and the macOS bundle's build number want numbers only; and the release workflow would have made it the latest release, which the update check hands out. The candidate now compares as older than its release and is never announced itself, both installers take the numbers alone, and a tag with a suffix publishes as a pre-release.
49 lines
1.7 KiB
Bash
Executable File
49 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build Fastpotify.app from a GUI binary, on a macOS machine.
|
|
#
|
|
# packaging/macos/bundle.sh <binary> <output.app> <version>
|
|
#
|
|
# Set CODESIGN_IDENTITY to sign with a Developer ID; the default is an ad-hoc
|
|
# signature, which arm64 requires before the app will launch at all.
|
|
#
|
|
# The .icns is generated here from the committed 1024px PNG, because iconutil
|
|
# only exists on macOS. The Info.plist template lives next to this script.
|
|
set -euo pipefail
|
|
|
|
binary="$1"
|
|
app="$2"
|
|
version="$3"
|
|
here="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
rm -rf "$app"
|
|
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
|
|
|
|
cp "$binary" "$app/Contents/MacOS/fastpotify"
|
|
chmod 755 "$app/Contents/MacOS/fastpotify"
|
|
# The build number has to be numbers: a release candidate's -rc1 comes off.
|
|
build="${version%%-*}"
|
|
sed -e "s/__VERSION__/$version/g" -e "s/__BUILD__/$build/g" "$here/Info.plist" \
|
|
> "$app/Contents/Info.plist"
|
|
|
|
iconset="$(mktemp -d)/fastpotify.iconset"
|
|
mkdir -p "$iconset"
|
|
# iconutil reads only these base sizes, each with an optional @2x. It ignores
|
|
# an icon_64x64 without saying so, so generating one is two wasted sips calls.
|
|
for size in 16 32 128 256 512; do
|
|
sips -z $size $size "$here/icon-1024.png" --out "$iconset/icon_${size}x${size}.png" >/dev/null
|
|
double=$((size * 2))
|
|
sips -z $double $double "$here/icon-1024.png" --out "$iconset/icon_${size}x${size}@2x.png" >/dev/null
|
|
done
|
|
iconutil -c icns "$iconset" -o "$app/Contents/Resources/fastpotify.icns"
|
|
|
|
# arm64 refuses to launch an unsigned bundle, so sign one way or another.
|
|
if [ -n "${CODESIGN_IDENTITY:-}" ]; then
|
|
codesign --force --timestamp --options runtime \
|
|
--sign "$CODESIGN_IDENTITY" "$app"
|
|
else
|
|
codesign --force --sign - "$app"
|
|
fi
|
|
codesign --verify --strict "$app"
|
|
|
|
echo "$app"
|