Skip to content

Commit c996e50

Browse files
ci: add error handling around code signing
1 parent bc78a11 commit c996e50

File tree

1 file changed

+44
-15
lines changed

1 file changed

+44
-15
lines changed

Scripts/make_artifacts.sh

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,50 @@
1010

1111
function build_framework_artifacts() {
1212
# Build old school "fat" frameworks for iOS and tvOS, both regular and no location builds
13-
./Scripts/carthage.sh build --no-skip-current
14-
15-
# Zip the Carthage frameworks (includes both platforms in each zip file)
16-
carthage archive mParticle_Apple_SDK
17-
carthage archive mParticle_Apple_SDK_NoLocation
13+
if ./Scripts/carthage.sh build --no-skip-current; then
14+
echo "Successfully built Carthage frameworks"
15+
16+
# Zip the Carthage frameworks (includes both platforms in each zip file)
17+
if carthage archive mParticle_Apple_SDK && carthage archive mParticle_Apple_SDK_NoLocation; then
18+
echo "Successfully archived Carthage frameworks"
19+
else
20+
echo "Warning: Failed to archive some Carthage frameworks"
21+
fi
22+
else
23+
echo "Warning: Carthage build failed, skipping framework artifacts"
24+
fi
1825

1926
# Clean up temp files
2027
rm -rf Carthage
2128
}
2229

2330
function build_xcframework_artifacts() {
2431
# Build modern xcframeworks which work on M1 macs and include both platforms in one package
25-
./Scripts/xcframework.sh mParticle-Apple-SDK mParticle_Apple_SDK
26-
./Scripts/xcframework.sh mParticle-Apple-SDK-NoLocation mParticle_Apple_SDK_NoLocation
32+
if ./Scripts/xcframework.sh mParticle-Apple-SDK mParticle_Apple_SDK && ./Scripts/xcframework.sh mParticle-Apple-SDK-NoLocation mParticle_Apple_SDK_NoLocation; then
33+
echo "Successfully built xcframeworks"
34+
35+
# Try to sign the xcframeworks, but don't fail if signing isn't available
36+
if codesign --timestamp -s "Apple Distribution: mParticle, inc (DLD43Y3TRP)" mParticle_Apple_SDK.xcframework 2>/dev/null; then
37+
echo "Successfully signed mParticle_Apple_SDK.xcframework"
38+
else
39+
echo "Warning: Could not sign mParticle_Apple_SDK.xcframework (certificate may not be available)"
40+
fi
41+
42+
if codesign --timestamp -s "Apple Distribution: mParticle, inc (DLD43Y3TRP)" mParticle_Apple_SDK_NoLocation.xcframework 2>/dev/null; then
43+
echo "Successfully signed mParticle_Apple_SDK_NoLocation.xcframework"
44+
else
45+
echo "Warning: Could not sign mParticle_Apple_SDK_NoLocation.xcframework (certificate may not be available)"
46+
fi
2747

28-
# Sign the xcframeworks
29-
codesign --timestamp -s "Apple Distribution: mParticle, inc (DLD43Y3TRP)" mParticle_Apple_SDK.xcframework
30-
codesign --timestamp -s "Apple Distribution: mParticle, inc (DLD43Y3TRP)" mParticle_Apple_SDK_NoLocation.xcframework
31-
32-
# Zip the xcframeworks
33-
zip -r mParticle_Apple_SDK.xcframework.zip mParticle_Apple_SDK.xcframework
34-
zip -r mParticle_Apple_SDK_NoLocation.xcframework.zip mParticle_Apple_SDK_NoLocation.xcframework
48+
# Zip the xcframeworks
49+
if zip -r mParticle_Apple_SDK.xcframework.zip mParticle_Apple_SDK.xcframework && zip -r mParticle_Apple_SDK_NoLocation.xcframework.zip mParticle_Apple_SDK_NoLocation.xcframework; then
50+
echo "Successfully created xcframework zip files"
51+
else
52+
echo "Warning: Failed to create some xcframework zip files"
53+
fi
54+
else
55+
echo "Warning: Failed to build xcframeworks, skipping xcframework artifacts"
56+
fi
3557

3658
# Clean up temp files
3759
rm -rf archives mParticle_Apple_SDK.xcframework mParticle_Apple_SDK_NoLocation.xcframework
@@ -62,6 +84,13 @@ function build_docs_artifact() {
6284

6385
# --- Main ---
6486

87+
echo "Starting artifact build process..."
88+
6589
build_framework_artifacts
66-
build_xcframework_artifacts
90+
build_xcframework_artifacts
6791
build_docs_artifact
92+
93+
echo "Artifact build process completed."
94+
95+
# Ensure the script always exits successfully for the release process
96+
exit 0

0 commit comments

Comments
 (0)