forked from hughkli/Lookin
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (110 loc) · 4.03 KB
/
Copy pathbuild-desktop.yml
File metadata and controls
131 lines (110 loc) · 4.03 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build Lookin Desktop
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Release build
runs-on: macos-15
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install CocoaPods
run: gem install cocoapods -v 1.17.0 --no-document
- name: Resolve dependencies
run: pod install
- name: Build universal Release app
run: |
set -euo pipefail
xcodebuild \
-workspace Lookin.xcworkspace \
-scheme LookinClient \
-configuration Release \
-destination 'generic/platform=macOS' \
-derivedDataPath "$RUNNER_TEMP/LookinDerivedData" \
CODE_SIGNING_ALLOWED=NO \
ARCHS='arm64 x86_64' \
ONLY_ACTIVE_ARCH=NO \
build
- 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'
uses: actions/upload-artifact@v7
with:
name: lookin-desktop-${{ github.run_id }}
path: dist/*
if-no-files-found: error
retention-days: 14
release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download packaged app
uses: actions/download-artifact@v8
with:
name: lookin-desktop-${{ github.run_id }}
path: dist
- name: Create or update release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
archive_path="$(find dist -type f -name '*.zip' -print -quit)"
test -n "$archive_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" \
dist/* \
--clobber \
--repo "$GITHUB_REPOSITORY"
else
gh release create "$GITHUB_REF_NAME" \
dist/* \
--generate-notes \
--title "Lookin SwiftUI Inspector $GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY"
fi