-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·39 lines (30 loc) · 1.01 KB
/
Copy pathpackage.sh
File metadata and controls
executable file
·39 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="Bucky"
APP_PATH="build/${APP_NAME}.app"
EXECUTABLE_PATH="${APP_PATH}/Contents/MacOS/${APP_NAME}"
INFO_PLIST="${APP_PATH}/Contents/Info.plist"
DIST_DIR="dist"
make clean
make bundle
if [[ ! -d "${APP_PATH}" ]]; then
echo "error: ${APP_PATH} does not exist after build." >&2
exit 1
fi
if [[ ! -x "${EXECUTABLE_PATH}" ]]; then
echo "error: ${EXECUTABLE_PATH} does not exist or is not executable." >&2
exit 1
fi
VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${INFO_PLIST}" 2>/dev/null || true)"
if [[ -z "${VERSION}" ]]; then
VERSION="dev"
fi
ARCHS="$(lipo -archs "${EXECUTABLE_PATH}")"
ARCH_LABEL="${ARCHS// /-}"
ZIP_PATH="${DIST_DIR}/${APP_NAME}-${VERSION}-macos-${ARCH_LABEL}.zip"
mkdir -p "${DIST_DIR}"
rm -f "${ZIP_PATH}" "${ZIP_PATH}.sha256"
ditto -c -k --sequesterRsrc --keepParent "${APP_PATH}" "${ZIP_PATH}"
shasum -a 256 "${ZIP_PATH}" > "${ZIP_PATH}.sha256"
echo "Created ${ZIP_PATH}"
echo "Created ${ZIP_PATH}.sha256"