Skip to content

Commit 9c5a64e

Browse files
robertmetaclaude
andcommitted
Fix universal binary build process
Fix GitHub Actions workflow to properly build separate architectures: - Save arm64 build artifacts before cleaning - Clean .build directory between builds - Save x86_64 build artifacts separately - Use lipo to combine from saved artifacts - Add verification steps to confirm architectures This prevents the "identical files" error by keeping builds separate. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
1 parent 9089add commit 9c5a64e

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,45 +55,68 @@ jobs:
5555
run: |
5656
echo "Building for Apple Silicon (arm64)..."
5757
swift build --configuration release --arch arm64
58-
mkdir -p .build/arm64-apple-macosx/release
59-
cp -r .build/release/* .build/arm64-apple-macosx/release/
58+
mkdir -p build-artifacts/arm64
59+
cp .build/release/swiftmac build-artifacts/arm64/
60+
cp -r .build/release/ogg.framework build-artifacts/arm64/
61+
cp -r .build/release/vorbis.framework build-artifacts/arm64/
62+
echo "Saved arm64 build artifacts"
63+
file build-artifacts/arm64/swiftmac
64+
65+
- name: Clean build directory
66+
run: |
67+
echo "Cleaning build directory..."
68+
rm -rf .build
6069
6170
- name: Build for Intel (x86_64)
6271
run: |
6372
echo "Building for Intel (x86_64)..."
6473
swift build --configuration release --arch x86_64
65-
mkdir -p .build/x86_64-apple-macosx/release
66-
cp -r .build/release/* .build/x86_64-apple-macosx/release/
74+
mkdir -p build-artifacts/x86_64
75+
cp .build/release/swiftmac build-artifacts/x86_64/
76+
cp -r .build/release/ogg.framework build-artifacts/x86_64/
77+
cp -r .build/release/vorbis.framework build-artifacts/x86_64/
78+
echo "Saved x86_64 build artifacts"
79+
file build-artifacts/x86_64/swiftmac
6780
6881
- name: Create Universal Binary
6982
run: |
7083
echo "Creating universal binary..."
7184
85+
# Verify source binaries
86+
echo "ARM64 binary:"
87+
file build-artifacts/arm64/swiftmac
88+
lipo -info build-artifacts/arm64/swiftmac
89+
90+
echo "x86_64 binary:"
91+
file build-artifacts/x86_64/swiftmac
92+
lipo -info build-artifacts/x86_64/swiftmac
93+
7294
# Create universal binary for swiftmac executable
7395
lipo -create \
74-
.build/arm64-apple-macosx/release/swiftmac \
75-
.build/x86_64-apple-macosx/release/swiftmac \
96+
build-artifacts/arm64/swiftmac \
97+
build-artifacts/x86_64/swiftmac \
7698
-output swiftmac-universal
7799
78100
# Verify it's universal
101+
echo "Universal binary:"
79102
file swiftmac-universal
80103
lipo -info swiftmac-universal
81104
82105
# Create universal frameworks by copying arm64 structure and merging binaries
83106
mkdir -p universal-frameworks
84107
85108
# OggDecoder framework
86-
cp -r .build/arm64-apple-macosx/release/ogg.framework universal-frameworks/
109+
cp -r build-artifacts/arm64/ogg.framework universal-frameworks/
87110
lipo -create \
88-
.build/arm64-apple-macosx/release/ogg.framework/ogg \
89-
.build/x86_64-apple-macosx/release/ogg.framework/ogg \
111+
build-artifacts/arm64/ogg.framework/ogg \
112+
build-artifacts/x86_64/ogg.framework/ogg \
90113
-output universal-frameworks/ogg.framework/ogg
91114
92115
# Vorbis framework
93-
cp -r .build/arm64-apple-macosx/release/vorbis.framework universal-frameworks/
116+
cp -r build-artifacts/arm64/vorbis.framework universal-frameworks/
94117
lipo -create \
95-
.build/arm64-apple-macosx/release/vorbis.framework/vorbis \
96-
.build/x86_64-apple-macosx/release/vorbis.framework/vorbis \
118+
build-artifacts/arm64/vorbis.framework/vorbis \
119+
build-artifacts/x86_64/vorbis.framework/vorbis \
97120
-output universal-frameworks/vorbis.framework/vorbis
98121
99122
# Verify frameworks are universal

0 commit comments

Comments
 (0)