Skip to content

Commit cd9a5fc

Browse files
authored
Optimize build-xcframework pipeline (#843)
1 parent bff879a commit cd9a5fc

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/actions/build-xcframework/action.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Build XCFrameworks'
2-
description: 'Build OpenSwiftUI xcframeworks, zip each one, and compute checksums'
2+
description: 'Build OpenSwiftUI xcframeworks and generate binaryTarget entries'
33

44
inputs:
55
xcode-version:
@@ -29,7 +29,7 @@ runs:
2929
- name: Build XCFrameworks
3030
run: Scripts/build_xcframework.sh OpenSwiftUI
3131
shell: bash
32-
- name: Zip and Compute Checksums
32+
- name: Compute Checksums and Generate Summary
3333
id: checksums
3434
shell: bash
3535
env:
@@ -46,13 +46,17 @@ runs:
4646
OpenRenderBoxShims
4747
)
4848
BODY=""
49-
echo "### XCFramework Checksums" >> $GITHUB_STEP_SUMMARY
49+
echo "### XCFramework Binary Targets" >> $GITHUB_STEP_SUMMARY
5050
echo "" >> $GITHUB_STEP_SUMMARY
5151
echo '```swift' >> $GITHUB_STEP_SUMMARY
5252
for fw in "${FRAMEWORKS[@]}"; do
53-
zip -r "$fw.xcframework.zip" "$fw.xcframework"
54-
CHECKSUM=$(swift package compute-checksum "$fw.xcframework.zip")
55-
ENTRY=$(printf '.binaryTarget(\n name: "%s",\n url: "https://github.com/OpenSwiftUIProject/OpenSwiftUI/releases/download/%s/%s.xcframework.zip",\n checksum: "%s"\n),' "$fw" "${TAG_NAME:-<TAG>}" "$fw" "$CHECKSUM")
53+
if [ -n "$TAG_NAME" ]; then
54+
zip -ry "$fw.xcframework.zip" "$fw.xcframework"
55+
CHECKSUM=$(swift package compute-checksum "$fw.xcframework.zip")
56+
ENTRY=$(printf '.binaryTarget(\n name: "%s",\n url: "https://github.com/OpenSwiftUIProject/OpenSwiftUI/releases/download/%s/%s.xcframework.zip",\n checksum: "%s"\n),' "$fw" "$TAG_NAME" "$fw" "$CHECKSUM")
57+
else
58+
ENTRY=$(printf '.binaryTarget(\n name: "%s",\n path: "%s.xcframework"\n),' "$fw" "$fw")
59+
fi
5660
echo "$ENTRY" >> $GITHUB_STEP_SUMMARY
5761
if [ -n "$BODY" ]; then
5862
BODY=$(printf '%s\n%s' "$BODY" "$ENTRY")

.github/workflows/build_xcframework.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
- uses: actions/checkout@v4
1616
- name: Build XCFrameworks
1717
uses: ./.github/actions/build-xcframework
18-
- name: Upload Artifacts
19-
uses: actions/upload-artifact@v4
18+
- name: Zip XCFrameworks
19+
run: cd build && zip -ry xcframeworks.zip *.xcframework
20+
- name: Upload XCFrameworks
21+
uses: actions/upload-artifact@v7
2022
with:
21-
name: xcframeworks
22-
path: build/*.xcframework.zip
23+
path: build/xcframeworks.zip
24+
archive: false

0 commit comments

Comments
 (0)