Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ jobs:
- uses: ./.github/actions/setup
with:
xcode: ${{ matrix.xcode }}
- name: Build XCFramework
run: bundle exec rake build:xcframework
- name: Upload XCFramework
- name: Build Dynamic XCFramework
run: bundle exec rake build:xcframework\['dynamic'\]
- name: Build Static XCFramework
run: bundle exec rake build:xcframework\['static'\]
- name: Upload XCFrameworks
uses: actions/upload-artifact@v4
with:
name: BuildProducts
path: .build/archives
path: .build/artifacts

cocoapod:
name: "Lint CocoaPods podspec"
Expand Down
43 changes: 26 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,31 @@ namespace :build do
end

desc 'Builds an xcframework for all supported platforms'
task :xcframework, [:zip_archive_name] do |_t, args|
args.with_defaults(:zip_archive_name => 'Lottie')
task :xcframework, [:framework_type] do |_t, args|
args.with_defaults(:framework_type => 'dynamic')

case args[:framework_type]
when 'dynamic'
mach_o_type = 'mh_dylib'
xcframework_name = 'Lottie' # Backward compatibility
when 'static'
mach_o_type = 'staticlib'
xcframework_name = 'Lottie-Static'
end

sh 'rm -rf .build/archives'

# Build the framework for each supported platform, including simulators
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (iOS)" -destination generic/platform=iOS -archivePath ".build/archives/Lottie_iOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (iOS)" -destination "generic/platform=iOS Simulator" -archivePath ".build/archives/Lottie_iOS_Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (iOS)" -destination "generic/platform=macOS,variant=Mac Catalyst" -archivePath ".build/archives/Lottie_Mac_Catalyst" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (macOS)" -destination generic/platform=macOS -archivePath ".build/archives/Lottie_macOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (tvOS)" -destination generic/platform=tvOS -archivePath ".build/archives/Lottie_tvOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (tvOS)" -destination "generic/platform=tvOS Simulator" -archivePath ".build/archives/Lottie_tvOS_Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (iOS)\" -destination generic/platform=iOS -archivePath \".build/archives/Lottie_iOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (iOS)\" -destination \"generic/platform=iOS Simulator\" -archivePath \".build/archives/Lottie_iOS_Simulator\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (iOS)\" -destination \"generic/platform=macOS,variant=Mac Catalyst\" -archivePath \".build/archives/Lottie_Mac_Catalyst\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (macOS)\" -destination generic/platform=macOS -archivePath \".build/archives/Lottie_macOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (tvOS)\" -destination generic/platform=tvOS -archivePath \".build/archives/Lottie_tvOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (tvOS)\" -destination \"generic/platform=tvOS Simulator\" -archivePath \".build/archives/Lottie_tvOS_Simulator\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")

ifVisionOSEnabled {
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (visionOS)" -destination generic/platform=visionOS -archivePath ".build/archives/Lottie_visionOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild('archive -workspace Lottie.xcworkspace -scheme "Lottie (visionOS)" -destination "generic/platform=visionOS Simulator" -archivePath ".build/archives/Lottie_visionOS_Simulator" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO')
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (visionOS)\" -destination generic/platform=visionOS -archivePath \".build/archives/Lottie_visionOS\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
xcodebuild("archive -workspace Lottie.xcworkspace -scheme \"Lottie (visionOS)\" -destination \"generic/platform=visionOS Simulator\" -archivePath \".build/archives/Lottie_visionOS_Simulator\" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_BITCODE=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO MACH_O_TYPE=\"#{mach_o_type}\"")
}

# Combine all of the platforms into a single XCFramework
Expand All @@ -96,11 +105,11 @@ namespace :build do
xcframeworkInvocation.push('-archive .build/archives/Lottie_visionOS_Simulator.xcarchive -framework Lottie.framework')
}

xcframeworkInvocation.push('-output .build/archives/Lottie.xcframework')
xcframeworkInvocation.push("-output .build/artifacts/#{xcframework_name}.xcframework")

xcodebuild(xcframeworkInvocation.join(" "))

Dir.chdir('.build/archives') do
Dir.chdir('.build/artifacts') do
# Codesign the XCFramework using the "Lottie iOS" certificate, which should be installed in the keychain.
# - Check to make sure the certificate is installed before attemtping to codesign.
# - In GitHub actions CI, only jobs run by contibutors have access to repo secrets,
Expand All @@ -110,19 +119,19 @@ namespace :build do
`security find-certificate -c 'Lottie iOS'`
if $?.success?
puts "Signing certificate is installed. Code signing Lottie.xcframework."
sh 'codesign --timestamp -v --sign "Lottie iOS" Lottie.xcframework'
sh "codesign --timestamp -v --sign \"Lottie iOS\" #{xcframework_name}.xcframework"
else
puts "Signing certificate is not installed. Lottie.xcframework will not be code signed."
puts "Signing certificate is not installed. #{xcframework_name}.xcframework will not be code signed."
end

# Archive the XCFramework into a zip file
# Use --symlinks to avoid "Multiple binaries share the same codesign path. This can happen if your build process copies frameworks by following symlinks."
# error when validating macOS apps (#1948)
sh "zip -r --symlinks #{args[:zip_archive_name]}.xcframework.zip Lottie.xcframework"
sh 'rm -rf Lottie.xcframework'
sh "zip -r --symlinks #{xcframework_name}.xcframework.zip #{xcframework_name}.xcframework"
sh "rm -rf #{xcframework_name}.xcframework"
end

sh "swift package compute-checksum .build/archives/#{args[:zip_archive_name]}.xcframework.zip"
sh "swift package compute-checksum .build/artifacts/#{xcframework_name}.xcframework.zip"
end
end

Expand Down
8 changes: 4 additions & 4 deletions script/ReleaseInstructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Lottie is made available through multiple package managers, each of which has to
2. Publish the new release in the [lottie-ios](https://github.com/airbnb/lottie-ios) repo
3. Update the [Cocoapod](https://cocoapods.org/pods/lottie-ios) by running `pod trunk push lottie-ios.podspec`
4. Update the [npm package](https://www.npmjs.com/package/lottie-ios) by running `npm publish`
5. Attach `Lottie.xframework.zip` to the GitHub release
- For every PR / commit, `Lottie.xcframework.zip` is built by CI and uploaded to the job summary once all jobs are completed.
- Make sure to use the `Lottie.xcframework.zip` from the CI job for the commit on master / the specific release tag and not from a PR CI job.
5. Attach `Lottie.xframework.zip` and `Lottie-Static.xframework.zip` to the GitHub release
- For every PR / commit, `Lottie.xcframework.zip` and `Lottie-Static.xcframework.zip` are built by CI and uploaded to the job summary once all jobs are completed.
- Make sure to use the `Lottie.xcframework.zip` and `Lottie-Static.xcframework.zip` from the CI job for the commit on master / the specific release tag and not from a PR CI job.
6. Update the [lottie-spm](https://github.com/airbnb/lottie-spm) [Package.swift](https://github.com/airbnb/lottie-spm/blob/main/Package.swift) manifest to reference the new version's XCFramework.
- You can compute the checksum by running `swift package compute-checksum Lottie.xcframework.zip`.
- You can compute the checksum by running `swift package compute-checksum Lottie.xcframework.zip` and `swift package compute-checksum Lottie-Static.xcframework.zip`.
- Optionally, consider updating the version number in `README.md` as well.
7. Publish the new release in the [lottie-spm](https://github.com/airbnb/lottie-spm) repo
Loading