Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Created August 20, 2021 02:46
Show Gist options
  • Save dezinezync/6afe37a6f65ccad9b9a19a9ef98fb978 to your computer and use it in GitHub Desktop.
Save dezinezync/6afe37a6f65ccad9b9a19a9ef98fb978 to your computer and use it in GitHub Desktop.
Build a macOS App and notarize it using Fastlane
default_platform(:mac)
platform :mac do
before_all do
# Make sure we start off with a clean slate
ensure_git_status_clean
end
desc "Create a notarized build of the macOS App"
lane :notarized do
# ensure_git_branch(
# branch: 'dev'
# )
increment_build_number(
xcodeproj: "Project.xcodeproj"
)
build_mac_app(
scheme: 'Project', # Skip if you only have a single scheme
configuration: 'Release',
export_method: "developer-id",
xcargs: '-allowProvisioningUpdates' # Needed for automatic signing
)
notarize(
asc_provider: "XXXXXXXXXX",
username: 'appstore@email.id',
print_log: true,
package: './Project.app',
verbose: true # Useful for showing notarization logs if it fails
)
end
after_all do |lane|
say "done"
commit_version_bump(
message: 'Version Bump via Fastlane',
xcodeproj: 'Project.xcodeproj', # optional, if you have multiple Xcode project files, you must specify your main project here
)
add_git_tag
push_to_git_remote
end
# Handle errors
error do |lane, exception|
# reset version bumps
reset_git_repo(
disregard_gitignore: false
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment