diff --git a/.gitignore b/.gitignore index 3c2f02fb2..2b89497a6 100644 --- a/.gitignore +++ b/.gitignore @@ -61,5 +61,5 @@ fastlane/screenshots # scan temporary files fastlane/test_output - fastlane/keys +env.sh diff --git a/HomeAssistant.xcodeproj/project.pbxproj b/HomeAssistant.xcodeproj/project.pbxproj index 9c9fab0bc..d028d3d6d 100644 --- a/HomeAssistant.xcodeproj/project.pbxproj +++ b/HomeAssistant.xcodeproj/project.pbxproj @@ -1377,7 +1377,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Fabric/run\" af2930e95b69736a32e543d07fe9c8078649a61e d1e18a77ecf813c5a72de304e2eb0bf1c2afc6098612966ac15ef9f1589ff506"; + shellScript = "[ -z \"$HOMEASSISTANT_FABRIC_CLIENT_ID\" ] && echo \"$HOMEASSISTANT_FABRIC_CLIENT_ID is not defined on your ENV\" && exit 0;\n [ -z \"$HOMEASSISTANT_FABRIC_SECRET\" ] && echo \"$HOMEASSISTANT_FABRIC_SECRET is not defined on your ENV\" && exit 0;\n \"${PODS_ROOT}/Fabric/run\" ${HOMEASSISTANT_FABRIC_CLIENT_ID} ${HOMEASSISTANT_FABRIC_SECRET}"; }; C1A731CE521F4B94A0023EB2 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/HomeAssistant/Info.plist b/HomeAssistant/Info.plist index 284dfb519..aa2365ee9 100644 --- a/HomeAssistant/Info.plist +++ b/HomeAssistant/Info.plist @@ -36,7 +36,7 @@ Fabric APIKey - af2930e95b69736a32e543d07fe9c8078649a61e + ${HOMEASSISTANT_FABRIC_CLIENT_ID} Kits diff --git a/fastlane/Appfile b/fastlane/Appfile index 2d6db723d..9f1ea1953 100644 --- a/fastlane/Appfile +++ b/fastlane/Appfile @@ -1,7 +1,4 @@ -apple_id "me@robbiet.us" app_identifier "io.robbie.HomeAssistant" # The bundle identifier of your app -team_id "UTQFCBPQRF" # Developer Portal Team ID - -# you can even provide different app identifiers, Apple IDs and team names per lane: -# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md +apple_id ENV["HOMEASSISTANT_APPLE_ID"] +team_id ENV["HOMEASSISTANT_TEAM_ID"] # Developer Portal Team ID diff --git a/fastlane/Deliverfile b/fastlane/Deliverfile index f5f9389aa..7943e7b3d 100644 --- a/fastlane/Deliverfile +++ b/fastlane/Deliverfile @@ -1,9 +1,3 @@ -###################### More Options ###################### -# If you want to have even more control, check out the documentation -# https://github.com/fastlane/fastlane/blob/master/deliver/Deliverfile.md - - -###################### Automatically generated ###################### -# Feel free to remove the following line if you use fastlane (which you should) - -app_identifier "io.robbie.HomeAssistant" # The bundle identifier of your app +app_identifier "io.robbie.HomeAssistant" +username ENV["HOMEASSISTANT_APPLE_ID"] +automatic_release false diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f6ba6bba9..97cec5eac 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,16 +18,38 @@ default_platform :ios platform :ios do before_all do # cocoapods + ENV["DELIVER_USERNAME"] = ENV["HOMEASSISTANT_APPLE_ID"] + ENV["MATCH_PASSWORD"] = ENV["HOMEASSISTANT_CERTIFICATE_KEY"] + ENV["PILOT_APPLE_ID"] = ENV["HOMEASSISTANT_APPLE_ID"] + ENV["SIGH_USERNAME"] = ENV["HOMEASSISTANT_APPLE_ID"] end desc "Fetches the provisioning profiles so you can build locally and deploy to your device" lane :certs do - match(app_identifier: "io.robbie.HomeAssistant", type: "development") - match(app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", type: "development") - match(app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", type: "development") - match(app_identifier: "io.robbie.HomeAssistant", type: "appstore") - match(app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", type: "appstore") - match(app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", type: "appstore") + match( + app_identifier: "io.robbie.HomeAssistant", + type: "development" + ) + match( + app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", + type: "development" + ) + match( + app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", + type: "development" + ) + match( + app_identifier: "io.robbie.HomeAssistant", + type: "appstore" + ) + match( + app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", + type: "appstore" + ) + match( + app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", + type: "appstore" + ) end def change_log_since_last_tag @@ -44,15 +66,6 @@ platform :ios do "#{build_type}/#{version_number}/#{build_number}" end - def load_keys - begin - import("keys") - rescue => exception - UI.error("fastlane/keys file not found. To use this Fastfile, copy fastlane/keys.template into fastlane/keys and fill in the values") - raise exception - end - end - private_lane :verify_xcode_version do ensure_xcode_version(version: REQUIRED_XCODE_VERSION) end @@ -60,7 +73,6 @@ platform :ios do desc "Submit a new Beta Build to Apple TestFlight" desc "This will also make sure the profile is up to date" lane :go_testflight do |options| - load_keys ensure_git_branch( branch: "(master|release\\S+|hotfix\\S+)" @@ -70,7 +82,7 @@ platform :ios do git_pull - #verify_xcode_version + verify_xcode_version version_number = options[:version_number] || get_version_number @@ -86,9 +98,19 @@ platform :ios do clean_build_artifacts clear_derived_data - match(app_identifier: "io.robbie.HomeAssistant", readonly: true) - match(app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", readonly: true) - match(app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", readonly: true) + match( + app_identifier: "io.robbie.HomeAssistant", + readonly: true + ) + match( + app_identifier: "io.robbie.HomeAssistant.APNSAttachmentService", + readonly: true + ) + match( + app_identifier: "io.robbie.HomeAssistant.NotificationContentExtension", + readonly: true + ) + gym( workspace: "HomeAssistant.xcworkspace", scheme: "HomeAssistant", @@ -97,7 +119,12 @@ platform :ios do output_directory: "./build" ) - notification(subtitle: "Finished Building", message: "Uploading to Testflight", activate: "com.googlecode.iterm2", app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png") + notification( + subtitle: "Finished Building", + message: "Uploading to Testflight", + activate: "com.googlecode.iterm2", + app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png" + ) pilot( changelog: change_log, @@ -105,7 +132,12 @@ platform :ios do distribute_external: false ) - notification(subtitle: "Finished Uploading", message: "Upload complete. Committing version bump and pushing to Git", activate: "com.googlecode.iterm2", app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png") + notification( + subtitle: "Finished Uploading", + message: "Upload complete. Committing version bump and pushing to Git", + activate: "com.googlecode.iterm2", + app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png" + ) commit_version_bump( message: "Version bump to #{complete_version_number}", @@ -116,14 +148,19 @@ platform :ios do set_github_release( repository_name: "home-assistant/home-assistant-iOS", - api_token: ENV["GITHUB_API_TOKEN"], + api_token: ENV["HOMEASSISTANT_GITHUB_API_TOKEN"], name: complete_version_number, tag_name: tag_name("testflight", version_number, build_number), description: change_log || "Release commit", is_prerelease: false ) - notification(subtitle: "Finished", message: "Build #{complete_version_number} built and uploaded to Testflight", activate: "com.googlecode.iterm2", app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png") + notification( + subtitle: "Finished", + message: "Build #{complete_version_number} built and uploaded to Testflight", + activate: "com.googlecode.iterm2", + app_icon:"https://raw.githubusercontent.com/fastlane/fastlane/master/fastlane/assets/fastlane.png" + ) rocket end @@ -132,9 +169,15 @@ platform :ios do lane :go_appstore do increment_build_number commit_version_bump - match(type: "appstore") + match( + type: "appstore" + ) # snapshot - gym(scheme: "HomeAssistant", workspace: "HomeAssistant.xcworkspace", output_directory: "./build") # Build your app - more options available + gym( + scheme: "HomeAssistant", + workspace: "HomeAssistant.xcworkspace", + output_directory: "./build" + ) # Build your app - more options available deliver(force: true) # frameit end diff --git a/fastlane/Matchfile b/fastlane/Matchfile index 50e9732ad..d647763b1 100644 --- a/fastlane/Matchfile +++ b/fastlane/Matchfile @@ -1,9 +1,9 @@ -git_url "https://github.com/home-assistant/ios-certificates" +git_url ENV["HOMEASSISTANT_CERTIFICATE_GIT"] type "appstore" # The default type, can be: appstore, adhoc or development app_identifier "io.robbie.HomeAssistant" -username "me@robbiet.us" # Your Apple Developer Portal username +username ENV["HOMEASSISTANT_APPLE_ID"] # Your Apple Developer Portal username # For all available options run `match --help` # Remove the # in the beginning of the line to enable the other options diff --git a/fastlane/keys.template b/fastlane/keys.template index 48ca955f9..d8e8e2c0d 100644 --- a/fastlane/keys.template +++ b/fastlane/keys.template @@ -1,5 +1,5 @@ ENV["GITHUB_API_TOKEN"] = "" ENV["APPLE_ID"] = "" -ENV["SIGH_USERNAME"] = ENV["APPLE_ID"] -ENV["PILOT_APPLE_ID"] = ENV["APPLE_ID"] -ENV["DELIVER_USERNAME"] = ENV["APPLE_ID"] +ENV["SIGH_USERNAME"] = ENV["HOMEASSISTANT_APPLE_ID"] +ENV["PILOT_APPLE_ID"] = ENV["HOMEASSISTANT_APPLE_ID"] +ENV["DELIVER_USERNAME"] = ENV["HOMEASSISTANT_APPLE_ID"]