1
+
2
+
3
+
4
+ name : XCFramework Release
5
+ on :
6
+ release :
7
+ types : [published]
8
+ jobs :
9
+ macos :
10
+ name : Build XCFramework
11
+ runs-on : macos-latest
12
+ steps :
13
+ - name : Checkout
14
+ uses : actions/checkout@v4
15
+ - name : Generate Xcode project
16
+ run : swift package --disable-sandbox tuist generate -p Projects/ --no-open
17
+ - name : Archive & Create XCFramework
18
+ run : |
19
+ # Define workspace and scheme
20
+ WORKSPACE='Projects/XCFramework.xcworkspace'
21
+ SCHEME='P256K'
22
+ CONFIGURATION='Release'
23
+ ARCHIVE_DIR='Archives'
24
+
25
+ # Platforms to archive
26
+ PLATFORMS=(
27
+ "iOS"
28
+ "iOS Simulator"
29
+ "macOS"
30
+ "tvOS"
31
+ "tvOS Simulator"
32
+ "watchOS"
33
+ "watchOS Simulator"
34
+ "visionOS"
35
+ )
36
+
37
+ # Loop over platforms and archive for each one
38
+ for PLATFORM in "${PLATFORMS[@]}"; do
39
+ echo "Archiving for $PLATFORM..."
40
+
41
+ # Run xcodebuild archive for each platform
42
+ xcodebuild archive \
43
+ -workspace "$WORKSPACE" \
44
+ -scheme "$SCHEME" \
45
+ -configuration "$CONFIGURATION" \
46
+ -destination "generic/platform=$PLATFORM" \
47
+ -archivePath "$ARCHIVE_DIR/P256K-$PLATFORM.xcarchive"
48
+
49
+ # Check if archive command was successful
50
+ if [ $? -eq 0 ]; then
51
+ echo "$PLATFORM archive created successfully."
52
+ else
53
+ echo "Failed to archive for $PLATFORM. Exiting."
54
+ exit 1
55
+ fi
56
+ done
57
+
58
+ echo "All archives completed successfully."
59
+
60
+ # Create an XCFramework to support multiple platforms and architectures
61
+ # Each -archive parameter specifies a path to a .xcarchive built for a different platform
62
+ # -framework specifies the framework within those archives to include in the XCFramework
63
+ # The -output parameter specifies the name and location of the XCFramework to be created
64
+ xcodebuild -create-xcframework \
65
+ -archive "Archives/P256K-iOS.xcarchive" -framework P256K.framework \
66
+ -archive "Archives/P256K-iOS Simulator.xcarchive" -framework P256K.framework \
67
+ -archive "Archives/P256K-macOS.xcarchive" -framework P256K.framework \
68
+ -archive "Archives/P256K-tvOS.xcarchive" -framework P256K.framework \
69
+ -archive "Archives/P256K-tvOS Simulator.xcarchive" -framework P256K.framework \
70
+ -archive "Archives/P256K-watchOS.xcarchive" -framework P256K.framework \
71
+ -archive "Archives/P256K-watchOS Simulator.xcarchive" -framework P256K.framework \
72
+ -output P256K.xcframework
73
+ - name : 7z XCFramework
74
+ run : |
75
+ 7z a -tzip -mx=9 P256K.xcframework.zip P256K.xcframework
76
+ - name : Upload XCFramework
77
+ run : |
78
+ gh release upload ${{ github.ref_name }} P256K.xcframework.zip
0 commit comments