Skip to content

Commit cf50346

Browse files
authored
Merge pull request #23 from RAKKUNN/fix/bundle-path-v4
fix: Patch Bundle.module → resourceURL (two-phase build)
2 parents 627de78 + e79da19 commit cf50346

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@ jobs:
3131
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
3232

3333
- name: Build (Release)
34-
run: swift build -c release
34+
run: |
35+
# First build to generate SPM resource bundle accessor
36+
swift build -c release
37+
38+
# Patch Bundle.module to use resourceURL (Contents/Resources/) instead of
39+
# bundleURL (.app/ root) which codesign rejects as "unsealed contents"
40+
find .build -name "resource_bundle_accessor.swift" -path "*/release/*" \
41+
-exec sed -i '' 's/Bundle\.main\.bundleURL/Bundle.main.resourceURL!/' {} \;
42+
43+
# Rebuild with patched accessor
44+
swift build -c release
3545
3646
# --- Code Signing ---
3747
- name: Import signing certificate
@@ -67,15 +77,10 @@ jobs:
6777
6878
cp .build/release/${{ env.APP_NAME }} "$APP_DIR/MacOS/"
6979
70-
# Copy SPM resource bundles (e.g. KeyboardShortcuts)
71-
# Bundle.module looks at Bundle.main.bundleURL (= .app/) first,
72-
# so place bundles at the .app root — the path SPM actually checks.
73-
APP_ROOT="${{ runner.temp }}/${{ env.APP_NAME }}.app"
74-
find .build -name "*.bundle" -path "*/release/*" -exec cp -R {} "$APP_ROOT/" \;
75-
76-
# Verify bundles were copied
77-
echo "=== .app root ==="
78-
ls -la "$APP_ROOT/" || true
80+
# Copy SPM resource bundles into Contents/Resources/
81+
find .build -name "*.bundle" -path "*/release/*" -exec cp -R {} "$APP_DIR/Resources/" \;
82+
echo "=== Resources ==="
83+
ls -la "$APP_DIR/Resources/" || true
7984
8085
cp ${{ env.APP_NAME }}/Info.plist "$APP_DIR/"
8186
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${{ steps.version.outputs.VERSION }}" "$APP_DIR/Info.plist"

0 commit comments

Comments
 (0)