Skip to content

Commit 828af3d

Browse files
authored
fix: package macOS builds as app bundles (#60)
1 parent a4753d3 commit 828af3d

3 files changed

Lines changed: 65 additions & 21 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ jobs:
100100
- name: Intel
101101
runner: macos-15-intel
102102
expect: x86_64
103-
artifact: TLEscope-macOS-Intel-Portable
103+
artifact: TLEscope-macOS-Intel-App
104+
archive: TLEscope-macOS-Intel.app.zip
104105
- name: Apple-Silicon
105106
runner: macos-15
106107
expect: arm64
107-
artifact: TLEscope-macOS-arm64-Portable
108+
artifact: TLEscope-macOS-arm64-App
109+
archive: TLEscope-macOS-arm64.app.zip
108110
env:
109111
MACOSX_DEPLOYMENT_TARGET: "11.0"
110112
steps:
@@ -113,19 +115,35 @@ jobs:
113115
with:
114116
submodules: recursive
115117

116-
- name: Build and bundle
118+
- name: Build portable application
117119
run: make macos
118120

121+
- name: Build app bundle
122+
run: |
123+
./macos_bundle.sh
124+
test -x dist/TLEscope.app/Contents/MacOS/TLEscope
125+
test -x dist/TLEscope.app/Contents/MacOS/TLEscope.bin
126+
test -f dist/TLEscope.app/Contents/Resources/themes/default/theme.json
127+
test -f dist/TLEscope.app/Contents/Resources/themes/default/font.ttf
128+
plutil -lint dist/TLEscope.app/Contents/Info.plist
129+
119130
- name: Verify architecture
120131
run: |
121-
file dist/TLEscope-macOS-Portable/TLEscope
122-
file dist/TLEscope-macOS-Portable/TLEscope | grep -q "${{ matrix.expect }}"
132+
file dist/TLEscope.app/Contents/MacOS/TLEscope.bin
133+
file dist/TLEscope.app/Contents/MacOS/TLEscope.bin | grep -q "${{ matrix.expect }}"
134+
135+
- name: Package app bundle
136+
run: |
137+
ditto -c -k --sequesterRsrc --keepParent \
138+
dist/TLEscope.app \
139+
"dist/${{ matrix.archive }}"
140+
unzip -l "dist/${{ matrix.archive }}" | grep -q "TLEscope.app/Contents/Resources/themes/default/font.ttf"
123141
124142
- name: Upload artifact
125143
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
126144
with:
127145
name: ${{ matrix.artifact }}
128-
path: dist/TLEscope-macOS-Portable/
146+
path: dist/${{ matrix.archive }}
129147
retention-days: 14
130148
if-no-files-found: error
131149

@@ -289,20 +307,18 @@ jobs:
289307
290308
chmod +x TLEscope-Linux-Portable/TLEscope
291309
chmod +x TLEscope-Linux-arm64-Portable/TLEscope
292-
chmod +x TLEscope-macOS-Intel-Portable/TLEscope
293-
chmod +x TLEscope-macOS-arm64-Portable/TLEscope
294310
295311
for artifact in \
296312
TLEscope-Linux-Portable \
297313
TLEscope-Linux-arm64-Portable \
298-
TLEscope-macOS-Intel-Portable \
299-
TLEscope-macOS-arm64-Portable \
300314
TLEscope-Win-Portable \
301315
TLEscope-Win-arm64-Portable
302316
do
303317
zip -r "../${artifact}.zip" "${artifact}/"
304318
done
305319
320+
mv TLEscope-macOS-Intel-App/TLEscope-macOS-Intel.app.zip ../
321+
mv TLEscope-macOS-arm64-App/TLEscope-macOS-arm64.app.zip ../
306322
mv TLEscope-Installer/TLEscope-Installer.exe ../
307323
308324
- name: Update nightly tag
@@ -326,8 +342,8 @@ jobs:
326342
files: |
327343
TLEscope-Linux-Portable.zip
328344
TLEscope-Linux-arm64-Portable.zip
329-
TLEscope-macOS-Intel-Portable.zip
330-
TLEscope-macOS-arm64-Portable.zip
345+
TLEscope-macOS-Intel.app.zip
346+
TLEscope-macOS-arm64.app.zip
331347
TLEscope-Win-Portable.zip
332348
TLEscope-Win-arm64-Portable.zip
333349
TLEscope-Installer.exe
@@ -342,8 +358,8 @@ jobs:
342358
files: |
343359
TLEscope-Linux-Portable.zip
344360
TLEscope-Linux-arm64-Portable.zip
345-
TLEscope-macOS-Intel-Portable.zip
346-
TLEscope-macOS-arm64-Portable.zip
361+
TLEscope-macOS-Intel.app.zip
362+
TLEscope-macOS-arm64.app.zip
347363
TLEscope-Win-Portable.zip
348364
TLEscope-Win-arm64-Portable.zip
349365
TLEscope-Installer.exe

‎bundle/Contents/MacOS/TLEscope‎

100644100755
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2-
# this workaround reeks probably please change it later
3-
cd "$(dirname "$0")"/../Resources
4-
../MacOS/TLEscope.bin
2+
set -e
3+
4+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
cd "$SCRIPT_DIR/../Resources"
6+
7+
exec "$SCRIPT_DIR/TLEscope.bin" "$@"

‎macos_bundle.sh‎

100644100755
Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
#!/bin/bash
2-
cp -r bundle dist/TLEscope.app
3-
cp -r dist/TLEscope-macOS-Portable/* dist/TLEscope.app/Contents/Resources
4-
mv dist/TLEscope.app/Contents/Resources/TLEscope dist/TLEscope.app/Contents/MacOS/TLEscope.bin
5-
chmod +x dist/TLEscope.app/Contents/MacOS/TLEscope # jus to be safe
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
cd "$ROOT_DIR"
6+
7+
PORTABLE_DIR="${1:-dist/TLEscope-macOS-Portable}"
8+
APP_DIR="${2:-dist/TLEscope.app}"
9+
10+
if [[ ! -x "$PORTABLE_DIR/TLEscope" ]]; then
11+
echo "Missing macOS executable: $PORTABLE_DIR/TLEscope" >&2
12+
exit 1
13+
fi
14+
15+
if [[ ! -d "$PORTABLE_DIR/themes" ]]; then
16+
echo "Missing theme resources: $PORTABLE_DIR/themes" >&2
17+
exit 1
18+
fi
19+
20+
rm -rf "$APP_DIR"
21+
cp -R bundle "$APP_DIR"
22+
mkdir -p "$APP_DIR/Contents/Resources"
23+
24+
cp -R "$PORTABLE_DIR"/. "$APP_DIR/Contents/Resources/"
25+
mv "$APP_DIR/Contents/Resources/TLEscope" "$APP_DIR/Contents/MacOS/TLEscope.bin"
26+
27+
chmod +x "$APP_DIR/Contents/MacOS/TLEscope"
28+
chmod +x "$APP_DIR/Contents/MacOS/TLEscope.bin"
29+
30+
echo "macOS app bundle created at $APP_DIR"

0 commit comments

Comments
 (0)