Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,43 @@ jobs:
ONLY_ACTIVE_ARCH=NO \
build

- name: Package app
- name: Build universal CLI
run: |
set -euo pipefail
LOOKINCTL_ARCHS='arm64 x86_64' \
LOOKINCTL_CODESIGN=0 \
LookinCLI/build.sh
lipo Build/lookinctl/lookinctl -verify_arch arm64 x86_64

- name: Package app and CLI
if: github.event_name != 'pull_request'
run: |
set -euo pipefail

app_path="$RUNNER_TEMP/LookinDerivedData/Build/Products/Release/Lookin.app"
cli_path="$GITHUB_WORKSPACE/Build/lookinctl/lookinctl"
test -d "$app_path"
test -x "$cli_path"

codesign --force --deep --sign - "$app_path"
codesign --verify --deep --strict "$app_path"
lipo "$app_path/Contents/MacOS/Lookin" -verify_arch arm64 x86_64

codesign --force --sign - "$cli_path"
codesign --verify --strict "$cli_path"
lipo "$cli_path" -verify_arch arm64 x86_64

ref_label="${GITHUB_REF_NAME//\//-}"
artifact_name="Lookin-SwiftUI-Inspector-${ref_label}-${GITHUB_SHA:0:7}"
artifact_dir="$GITHUB_WORKSPACE/dist"
archive_path="$artifact_dir/${artifact_name}.zip"

mkdir -p "$artifact_dir"
ditto -c -k --sequesterRsrc --keepParent "$app_path" "$archive_path"
tar -czf "$artifact_dir/lookinctl-macos-universal.tar.gz" -C "$(dirname "$cli_path")" "$(basename "$cli_path")"
cd "$artifact_dir"
shasum -a 256 "${artifact_name}.zip" > "${artifact_name}.zip.sha256"
shasum -a 256 lookinctl-macos-universal.tar.gz > lookinctl-macos-universal.tar.gz.sha256

- name: Upload packaged app
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -97,19 +113,18 @@ jobs:

archive_path="$(find dist -type f -name '*.zip' -print -quit)"
test -n "$archive_path"
checksum_path="${archive_path}.sha256"
test -f "$checksum_path"
test -f "${archive_path}.sha256"
test -f dist/lookinctl-macos-universal.tar.gz
test -f dist/lookinctl-macos-universal.tar.gz.sha256

if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" \
"$archive_path" \
"$checksum_path" \
dist/* \
--clobber \
--repo "$GITHUB_REPOSITORY"
else
gh release create "$GITHUB_REF_NAME" \
"$archive_path" \
"$checksum_path" \
dist/* \
--generate-notes \
--title "Lookin SwiftUI Inspector $GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY"
Expand Down
Loading