Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

1.4 KB
Raw Blame
#!/bin/bash
# Packages build/Cra.app into build/dist/: a zip, a DMG with the drag-to-install
# window (resources/dmg), and SHA-256 checksums. Signs the DMG when CRA_SIGN_IDENTITY is set.
#   scripts/package.sh [path/to/Cra.app]
set -euo pipefail
cd "$(dirname "$0")/.."
APP="${1:-build/Cra.app}"
[ -d "$APP" ] || { echo "No app at $APP. Run scripts/build.sh first." >&2; exit 1; }
VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"
IDENTITY="${CRA_SIGN_IDENTITY:--}"
DIST="build/dist"
rm -rf "$DIST" && mkdir -p "$DIST"

ZIP="$DIST/Cra.zip"
DMG="$DIST/Cra.dmg"

# Zip: ditto keeps resource forks and symlinks, which codesign requires.
ditto -c -k --keepParent "$APP" "$ZIP"

# DMG: dmgbuild writes the Finder layout (background, icon positions, hidden
# chrome) into .DS_Store directly, so no Finder scripting and it works on CI.
# Layout in resources/dmg/settings.py.
VENV="build/dmgbuild-venv"
if [ ! -x "$VENV/bin/dmgbuild" ]; then
  python3 -m venv "$VENV"
  "$VENV/bin/pip" install --quiet --disable-pip-version-check dmgbuild==1.6.7
fi
"$VENV/bin/dmgbuild" -s resources/dmg/settings.py -D app="$APP" "Cra" "$DMG"
if [ "$IDENTITY" != "-" ]; then
  codesign --force --sign "$IDENTITY" --timestamp "$DMG"
fi

(cd "$DIST" && shasum -a 256 "$(basename "$ZIP")" "$(basename "$DMG")" > "SHA256SUMS.txt")
echo "Packaged:"
ls -la "$DIST"