package.sh
bash
sha256:bd1eb24434d281fe65142038c1bf217493421f5a86880c22dff7e6037d2d4700
feat(companion): add production macOS distribution path
Human
minor
⚠ breaking
24 days ago
| 1 | #!/bin/bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | app="" |
| 5 | identity="" |
| 6 | output="" |
| 7 | while [[ $# -gt 0 ]]; do |
| 8 | case "$1" in |
| 9 | --app) app="$2"; shift 2 ;; |
| 10 | --installer-identity) identity="$2"; shift 2 ;; |
| 11 | --output) output="$2"; shift 2 ;; |
| 12 | *) echo "unknown argument: $1" >&2; exit 2 ;; |
| 13 | esac |
| 14 | done |
| 15 | |
| 16 | [[ -d "$app" && -n "$output" ]] || { echo "--app and --output are required" >&2; exit 2; } |
| 17 | [[ -n "$identity" && "$identity" != *'<'* ]] || { echo "real Developer ID Installer identity required" >&2; exit 1; } |
| 18 | codesign --verify --deep --strict "$app" |
| 19 | |
| 20 | repo_root="$(cd "$(dirname "$0")/../../.." && pwd)" |
| 21 | node "$repo_root/scripts/release/macos/verify-runtime-manifest.mjs" \ |
| 22 | --app "$app" --require-committed-source |
| 23 | release_version="$(node -p "require('$repo_root/release/macos/release.json').version")" |
| 24 | release_build="$(node -p "require('$repo_root/release/macos/release.json').build")" |
| 25 | package_work="$repo_root/build/phase7/package" |
| 26 | payload="$package_work/payload" |
| 27 | rm -rf "$package_work" |
| 28 | mkdir -p "$payload/Applications" "$payload/usr/local/bin" "$(dirname "$output")" |
| 29 | ditto "$app" "$payload/Applications/Knowtation.app" |
| 30 | cp "$app/Contents/Helpers/knowtation" "$payload/usr/local/bin/knowtation" |
| 31 | cp "$app/Contents/Helpers/knowtation-mcp" "$payload/usr/local/bin/knowtation-mcp" |
| 32 | chmod 755 "$payload/usr/local/bin/knowtation" "$payload/usr/local/bin/knowtation-mcp" |
| 33 | |
| 34 | pkgbuild \ |
| 35 | --root "$payload" \ |
| 36 | --scripts "$repo_root/release/macos/pkg-scripts" \ |
| 37 | --ownership recommended \ |
| 38 | --identifier store.knowtation.pkg \ |
| 39 | --version "$release_version.$release_build" \ |
| 40 | --install-location / \ |
| 41 | "$package_work/Knowtation-component.pkg" |
| 42 | |
| 43 | productbuild \ |
| 44 | --distribution "$repo_root/release/macos/Distribution.xml" \ |
| 45 | --package-path "$package_work" \ |
| 46 | --sign "$identity" \ |
| 47 | "$output" |
| 48 | |
| 49 | pkgutil --check-signature "$output" |
| 50 | echo "$output" |
File History
1 commit
sha256:bd1eb24434d281fe65142038c1bf217493421f5a86880c22dff7e6037d2d4700
feat(companion): add production macOS distribution path
Human
minor
⚠
24 days ago