#!/bin/zsh set -euo pipefail PROJECT_DIR=${0:A:h:h} APP_DIR="$PROJECT_DIR/dist/WhisperKey.app" INPUT_APP_DIR="$PROJECT_DIR/dist/WhisperKeyInput.app" cd "$PROJECT_DIR" swift build -c release rm -rf "$APP_DIR" mkdir -p "$APP_DIR/Contents/MacOS" "$APP_DIR/Contents/Resources" cp "$PROJECT_DIR/.build/release/WhisperKey" "$APP_DIR/Contents/MacOS/WhisperKey" cp "$PROJECT_DIR/Resources/Info.plist" "$APP_DIR/Contents/Info.plist" codesign --force --deep --sign - "$APP_DIR" rm -rf "$INPUT_APP_DIR" mkdir -p "$INPUT_APP_DIR/Contents/MacOS" "$INPUT_APP_DIR/Contents/Resources" cp "$PROJECT_DIR/.build/release/WhisperKeyInput" "$INPUT_APP_DIR/Contents/MacOS/WhisperKeyInput" cp "$PROJECT_DIR/Resources/InputMethod-Info.plist" "$INPUT_APP_DIR/Contents/Info.plist" sips -s format tiff "$PROJECT_DIR/Resources/WhisperKeyInput.svg" \ --out "$INPUT_APP_DIR/Contents/Resources/WhisperKeyInputTemplateV2.tiff" >/dev/null codesign --force --deep --sign - "$INPUT_APP_DIR" echo "$APP_DIR" echo "$INPUT_APP_DIR"