Files
yattee/fastlane/Fastfile
Arkadiusz Fal bf40f527ea Add macOS framework conversion for Developer ID distribution
This commit implements a workaround for MPVKit shipping frameworks as
shallow bundles, which are incompatible with macOS Developer ID
distribution requirements.

Changes:

1. Raised macOS deployment target to 14.0
   - Matches MPVKit's minimum requirement
   - Previous: 11.0
   - New: 14.0

2. Added Run Script phase to convert frameworks
   - Converts MPVKit frameworks from shallow to versioned bundles
   - Required for macOS Developer ID code signing
   - Runs after framework embedding
   - Converts all 28 MPVKit frameworks during build

3. Modified fastlane build process
   - Build and archive without export
   - Create PKG directly from archive
   - Avoids extended attribute issues from export process

4. Pinned MPVKit to specific commit
   - Commit: e7e914a70e943f0d4f050c9ede793af8f6e74ad7
   - Ensures consistent framework structure

Known Issues:
- Some frameworks (Libplacebo, Libluajit) have signature issues after
  conversion that still prevent successful notarization
- This is a workaround; the root issue should be fixed in MPVKit by
  providing macOS-compatible versioned bundle frameworks

See minimal reproduction project at:
/tmp/MPVKit-Notarization-Issue/MPVKitNotarizationTest/

Related: MPVKit should provide macOS-specific XCFrameworks with
versioned bundles for proper Developer ID distribution support.

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 12:32:32 +01:00

285 lines
8.1 KiB
Ruby

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
APP_NAME = ENV['APP_NAME']
DEVELOPER_KEY_ID = ENV['DEVELOPER_KEY_ID']
DEVELOPER_KEY_ISSUER_ID = ENV['DEVELOPER_KEY_ISSUER_ID']
DEVELOPER_KEY_CONTENT = ENV['DEVELOPER_KEY_CONTENT']
TEAM_ID = ENV['TEAM_ID']
TEMP_KEYCHAIN_USER = ENV['TEMP_KEYCHAIN_USER']
TEMP_KEYCHAIN_PASSWORD = ENV['TEMP_KEYCHAIN_PASSWORD']
DEVELOPER_APP_IDENTIFIER = ENV['DEVELOPER_APP_IDENTIFIER']
GIT_AUTHORIZATION = ENV['GIT_AUTHORIZATION']
TESTFLIGHT_EXTERNAL_GROUPS = ENV['TESTFLIGHT_EXTERNAL_GROUPS']
XCODEPROJ = "#{APP_NAME}.xcodeproj"
def delete_temp_keychain(name)
delete_keychain(
name: name
) if File.exist? File.expand_path("~/Library/Keychains/#{name}-db")
end
def create_temp_keychain(name, password)
create_keychain(
name: name,
password: password,
unlock: false,
timeout: 0
)
end
def ensure_temp_keychain(name, password)
delete_temp_keychain(name)
create_temp_keychain(name, password)
end
add_extra_platforms(platforms: [:tvos])
before_all do
update_fastlane
end
desc "Bump build number and commit"
lane :bump_build do
increment_build_number(xcodeproj: XCODEPROJ)
commit_version_bump(
message: "Bump build number to #{get_build_number(xcodeproj: XCODEPROJ)}",
xcodeproj: XCODEPROJ
)
end
desc "Bump version number and commit"
lane :bump_version do
increment_version_number
commit_version_bump(
message: "Bump version number to #{get_version_number}",
xcodeproj: XCODEPROJ
)
end
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
api_key = app_store_connect_api_key(
key_id: DEVELOPER_KEY_ID,
issuer_id: DEVELOPER_KEY_ISSUER_ID,
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (iOS)"
)
match(
type: 'appstore',
platform: 'ios',
app_identifier: ["#{DEVELOPER_APP_IDENTIFIER}", "#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"],
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: TEMP_KEYCHAIN_USER,
keychain_password: TEMP_KEYCHAIN_PASSWORD,
api_key: api_key
)
build_app(
scheme: "#{APP_NAME} (iOS)",
output_directory: "fastlane/builds/#{version}-#{build}/iOS",
output_name: "#{APP_NAME}-#{version}-iOS.ipa",
export_options: {
provisioningProfiles: {
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}",
"#{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER}.Open-in-#{APP_NAME}"
}
}
)
changelog = File.read('../CHANGELOG.md')
upload_to_testflight(
api_key: api_key,
ipa: lane_context[SharedValues::IPA_OUTPUT_PATH],
# distribute_external: true,
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
changelog: changelog
)
end
end
platform :tvos do
desc "Push a new beta build to TestFlight"
lane :beta do
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
api_key = app_store_connect_api_key(
key_id: DEVELOPER_KEY_ID,
issuer_id: DEVELOPER_KEY_ISSUER_ID,
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (tvOS)"
)
match(
type: 'appstore',
platform: 'tvos',
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: TEMP_KEYCHAIN_USER,
keychain_password: TEMP_KEYCHAIN_PASSWORD,
api_key: api_key
)
build_app(
scheme: "#{APP_NAME} (tvOS)",
output_directory: "fastlane/builds/#{version}-#{build}/tvOS",
output_name: "#{APP_NAME}-#{version}-tvOS.ipa",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER} tvos"
}
}
)
changelog = File.read('../CHANGELOG.md')
upload_to_testflight(
api_key: api_key,
ipa: lane_context[SharedValues::IPA_OUTPUT_PATH],
# distribute_external: true,
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
changelog: changelog
)
end
end
platform :mac do
desc "Push a new beta build to TestFlight"
lane :beta do
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
api_key = app_store_connect_api_key(
key_id: DEVELOPER_KEY_ID,
issuer_id: DEVELOPER_KEY_ISSUER_ID,
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (macOS)"
)
match(
type: 'appstore',
platform: 'macos',
additional_cert_types: ['mac_installer_distribution'],
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: TEMP_KEYCHAIN_USER,
keychain_password: TEMP_KEYCHAIN_PASSWORD,
api_key: api_key
)
build_app(
scheme: "#{APP_NAME} (macOS)",
output_directory: "fastlane/builds/#{version}-#{build}/macOS",
output_name: "#{APP_NAME}-#{version}-macOS.app",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"#{DEVELOPER_APP_IDENTIFIER}" => "match AppStore #{DEVELOPER_APP_IDENTIFIER} macos"
}
}
)
changelog = File.read('../CHANGELOG.md')
upload_to_testflight(
api_key: api_key,
pkg: lane_context[SharedValues::PKG_OUTPUT_PATH],
# distribute_external: true,
# groups: TESTFLIGHT_EXTERNAL_GROUPS,
changelog: changelog
)
end
desc "Build for Developer ID distribution and notarize"
lane :build_and_notarize do
ensure_temp_keychain(TEMP_KEYCHAIN_USER, TEMP_KEYCHAIN_PASSWORD)
api_key = app_store_connect_api_key(
key_id: DEVELOPER_KEY_ID,
issuer_id: DEVELOPER_KEY_ISSUER_ID,
key_content: DEVELOPER_KEY_CONTENT
)
build = get_build_number(xcodeproj: XCODEPROJ)
version = get_version_number(
xcodeproj: XCODEPROJ,
target: "#{APP_NAME} (macOS)"
)
match(
type: 'developer_id',
platform: 'macos',
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
git_basic_authorization: Base64.strict_encode64(GIT_AUTHORIZATION),
readonly: true,
keychain_name: TEMP_KEYCHAIN_USER,
keychain_password: TEMP_KEYCHAIN_PASSWORD,
api_key: api_key
)
# Build and archive, but skip export to avoid extended attribute issues
gym(
scheme: "#{APP_NAME} (macOS)",
skip_package_pkg: true,
skip_archive: false
)
# Get the app from the archive's InstallationBuildProductsLocation
archive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE]
app_path = "#{archive_path}/Products/Applications/#{APP_NAME}.app"
UI.message("Archive path: #{archive_path}")
UI.message("App path: #{app_path}")
# Create PKG directly from the archived app (before any export processing)
pkg_path = File.expand_path("builds/#{version}-#{build}/macOS/#{APP_NAME}.pkg", File.dirname(__FILE__))
UI.message("Creating PKG installer from archived app...")
sh("productbuild --component '#{app_path}' /Applications --sign 'Developer ID Installer: Arkadiusz Fal (78Z5H3M6RJ)' '#{pkg_path}'")
UI.success("Created PKG: #{pkg_path}")
notarize(
package: pkg_path,
bundle_id: "#{DEVELOPER_APP_IDENTIFIER}",
api_key: api_key,
print_log: true
)
end
end