xcode_fastlane 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b95323aded86c129ece9f2169b98007e0d4d72c2e864363328c167d81fb3c5b3
4
- data.tar.gz: a4d59475d34dae4288b5c570f81bd92fce8ebf3fda0f86ae4f21c3563d4d37d7
3
+ metadata.gz: 2e2663ea7a9423640263850234ef3e7d77e90ed560f0e3c075370ee1c090c2cc
4
+ data.tar.gz: 4cfa19a676af15c29b0bcc853e0b38ed73b4c2bb77d846323e500cb0bf65fda7
5
5
  SHA512:
6
- metadata.gz: 779185baf85ba1cf858c53557c70eb9b8b0c638f306739adf203f9f5fba9bfb3a7cab426dc3f14c337d85e1bdd5d5372e7ac7d8dd9a37868d71b5df5f269a090
7
- data.tar.gz: bcbd8158ed2a548b9d64cbb759e3948dc2f88d6b3ae91c9331c06e1d16f9d1d42690c19b4b3a65a228614972156096b861c440e63540dc32094417d2cfe23c49
6
+ metadata.gz: 93dbf3ec6a82312fa73341ce2ae406ebe2f33e27f8958c512386f5ede94572ec8124e864dad04737a0dcbdde133053846e38b3e6f3c6e5ca36ce51394a64e4dd
7
+ data.tar.gz: f9071ea3c917e26da59a39ff2332117a819c6cdfba7e6c9845637241c65947de7a3bfd7105c19d29139570f4bcfc59cf0e42300c70db072ee78950d4c132dd6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.2.0 (2024-05-21)
2
+
3
+ ### Features
4
+
5
+ - new fastfile with proper lane setup
6
+
7
+ ## 1.1.0 (2024-05-17)
8
+
9
+ ### Features
10
+
11
+ - add method to switch to new git branch
12
+
1
13
  ## 1.0.3 (2024-05-14)
2
14
 
3
15
  ### Bug fixes
data/fastlane/Fastfile CHANGED
@@ -6,56 +6,150 @@ opt_out_usage
6
6
  default_platform(:ios)
7
7
 
8
8
  platform :ios do
9
- # https://www.runway.team/blog/how-to-set-up-a-ci-cd-pipeline-for-your-ios-app-fastlane-github-actions
10
- desc "Load AppStore Connect API Key information to use in subsequent lanes"
11
- lane :load_api_key do
12
- app_store_connect_api_key(
13
- key_id: ENV.fetch("APPSTORE_CONNECT_API_KEY_ID", nil),
14
- issuer_id: ENV.fetch("APPSTORE_CONNECT_API_KEY_ISSUER_ID", nil),
15
- key_content: ENV.fetch("APPSTORE_CONNECT_API_KEY_P8", nil),
16
- is_key_content_base64: true,
17
- in_house: false # detecting this via AppStore Connect private key not currently supported
18
- )
9
+ before_all do
10
+ Dotenv.load ".env.ios"
11
+ end
12
+ end
13
+
14
+ platform :macos do
15
+ before_all do
16
+ Dotenv.load ".env.mac"
17
+ end
18
+ end
19
+
20
+ platform :ios do
21
+
22
+ desc "Create app on Apple Developer and App Store Connect"
23
+ lane :create_app do
24
+ create_app_online # produce
25
+ end
26
+
27
+ desc "Prepare Xcode project for use with match code signing"
28
+ lane :prepare_for_match do
29
+ update_code_signing_settings
30
+ match
19
31
  end
20
32
 
21
- desc "Register app on Apple Developer Portal and AppStore Connect"
22
- lane :register do
23
- create_app_online( # produce
24
- language: "en-US",
25
- # com.example.AppName => com.example.apps.AppName.ios
26
- sku: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
27
- .split(".").insert(2, "apps").append("ios").join("."),
28
- enable_services: {}
33
+ desc "Prepare app for use with auto versioning.\n"
34
+ desc "Param `commit: true` to commit changes.\n"
35
+ desc "Required once locally."
36
+ lane :prepare_for_versioning do |options|
37
+ prepare_versioning
38
+ if options[:commit]
39
+ git_commit(allow_nothing_to_commit: true,
40
+ message: "build: update versioning system",
41
+ path: ["*.plist", "*.pbxproj"])
42
+ end
43
+ end
44
+
45
+ desc "Sync certificates"
46
+ lane :sync_certs_and_profiles do |options|
47
+ if options[:auto]
48
+ get_certificates # invokes cert
49
+ get_provisioning_profile # invokes sigh
50
+ else
51
+ sync_code_signing({readonly: true, type: "appstore"}) # invokes match
52
+ update_code_signing_settings(
53
+ profile_name: lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING][ENV["APP_IDENTIFIER"]],
54
+ )
55
+ end
56
+ end
57
+
58
+ desc "Write release notes"
59
+ lane :write_release_notes do |options|
60
+ content = options[:text]
61
+ UI.user_error!("No changelog passed.") if content.nil?
62
+
63
+ release_notes_file = Dir.glob("**/default/release_notes.txt").first
64
+ UI.user_error!("No default release notes file found.") if release_notes_file.nil?
65
+
66
+ File.write(release_notes_file, content)
67
+ return release_notes_file
68
+ end
69
+
70
+ desc "Ensure to be on a release branch for the next release"
71
+ lane :ensure_release_branch_and_version do
72
+ unless branch_name.start_with?(ENV["RELEASE_BRANCH_PREFIX"])
73
+ if get_versioning_info
74
+ new_version = lane_context[SharedValues::SEMVER_NEW_VERSION]
75
+ UI.message("New version: #{new_version}")
76
+
77
+ # new branch
78
+ XcodeFastlane.checkout_branch("#{ENV["RELEASE_BRANCH_PREFIX"]}#{new_version}")
79
+
80
+ file = write_release_notes(text: lane_context[SharedValues::SEMVER_NEW_CHANGELOG])
81
+ git_add(path: file)
82
+
83
+ # Create version via commitizen
84
+ semantic_bump
85
+ else
86
+ UI.user_error!("No new version to bump.")
87
+ end
88
+ end
89
+ end
90
+
91
+ desc "Create ipa"
92
+ lane :build do
93
+ sync_certs_and_profiles
94
+ # Commit changes made by match
95
+ git_commit(
96
+ allow_nothing_to_commit: true,
97
+ message: "build: update certificate and provision setting",
98
+ path: ["*.plist", "*.pbxproj"]
29
99
  )
100
+
101
+ # Increases the build number by 1
102
+ old_build_number = get_build_number
103
+ increment_build_number
104
+
105
+ # Creates a signed file
106
+ build_app # invokes gym
107
+
108
+ commit_version_bump(message: "bump: build #{old_build_number} → #{lane_context[SharedValues::BUILD_NUMBER]}")
30
109
  end
31
110
 
32
- desc "Generate and upload new localized screenshots and metadata"
33
- desc "Params: send_success: boolean, indicating whether to send a success message via slack"
34
- lane :upload_appstore_data do |options|
111
+ desc "Take screenshots."
112
+ lane :screenshot do
35
113
  capture_screenshots(scheme: ENV.fetch("IOS_SCHEME", nil))
36
- load_api_key
37
- register
38
- upload_to_app_store( # deliver
39
- skip_binary_upload: true,
40
- skip_screenshots: false,
41
- skip_metadata: false,
42
- skip_app_version_update: false,
43
- overwrite_screenshots: true,
44
- force: true,
45
- # Precheck cannot check In-app purchases with the App Store Connect API Key (yet).
46
- precheck_include_in_app_purchases: false,
47
- app_review_information: {
48
- first_name: ENV.fetch("FASTLANE_REVIEW_FIRSTNAME", nil),
49
- last_name: ENV.fetch("FASTLANE_REVIEW_LASTNAME", nil),
50
- phone_number: ENV.fetch("FASTLANE_REVIEW_PHONE", nil),
51
- email_address: ENV.fetch("FASTLANE_REVIEW_EMAIL", nil)
52
- }
53
- )
114
+ end
115
+
116
+ desc "Upload to App Store."
117
+ lane :upload_testflight do
118
+ app_store_connect_api_key
119
+ testflight # invokes pilot
120
+ end
121
+
122
+ desc "Upload to App Store."
123
+ lane :upload_appstore do
124
+ app_store_connect_api_key
125
+ upload_to_app_store # invokes deliver
126
+ end
127
+
128
+ desc "Create release branch, build, and upload to TestFlight."
129
+ lane :beta do
130
+ run_tests # invokes scan
131
+ ensure_release_branch_and_version
132
+ build
133
+ upload_testflight
134
+ rescue StandardError => e
135
+ on_error(e)
136
+ raise
137
+ else
138
+ on_success("Beta build finished and uploaded to TestFlight")
139
+ end
140
+
141
+ desc "Create app, screenshot, build and upload."
142
+ lane :release_app do
143
+ create_app
144
+ ensure_release_branch_and_version
145
+ build
146
+ screenshot
147
+ upload_appstore
54
148
  rescue StandardError => e
55
149
  on_error(e)
56
150
  raise
57
151
  else
58
- on_success("Data uploaded to AppStore Connect") if options[:send_success]
152
+ on_success("Build and upload to AppStore finished.")
59
153
  end
60
154
  end
61
155
 
@@ -67,6 +161,7 @@ def on_success(message, **_props)
67
161
  success: true,
68
162
  slack_url: ENV.fetch("FASTLANE_SLACK_URL", nil),
69
163
  payload: {
164
+ "Build Number" => lane_context[SharedValues::BUILD_NUMBER],
70
165
  "CI Build Number" => ENV.fetch("CI_BUILD_NUMBER", nil),
71
166
  "CI Workflow" => ENV.fetch("CI_WORKFLOW", nil)
72
167
  }
@@ -81,6 +176,7 @@ def on_error(exception)
81
176
  success: false,
82
177
  slack_url: ENV.fetch("FASTLANE_SLACK_URL", nil),
83
178
  payload: {
179
+ "Build Number" => lane_context[SharedValues::BUILD_NUMBER],
84
180
  "CI Build Number" => ENV.fetch("CI_BUILD_NUMBER", nil),
85
181
  "CI Workflow" => ENV.fetch("CI_WORKFLOW", nil)
86
182
  },
@@ -95,3 +191,15 @@ def on_error(exception)
95
191
  }
96
192
  )
97
193
  end
194
+
195
+ private_lane :get_app_category do
196
+ app_category = nil
197
+ project = Xcodeproj::Project.open("../#{ENV["PROJECT_XCODEPROJ"]}")
198
+ project.objects.each do |object|
199
+ if object.isa == "XCBuildConfiguration" && object.name == "Release"
200
+ app_category = object.build_settings["INFOPLIST_KEY_LSApplicationCategoryType"]
201
+ break if app_category
202
+ end
203
+ end
204
+ app_category
205
+ end
@@ -13,12 +13,21 @@ module XcodeFastlane
13
13
 
14
14
  desc "init", "Initialize fastlane setup"
15
15
  def init
16
- copy_file ".gitignore"
17
- copy_file "Gemfile"
18
- copy_file "fastlane/Appfile"
19
- copy_file "fastlane/Deliverfile"
20
- copy_file "fastlane/Fastfile"
21
- copy_file "fastlane/Snapfile"
16
+ %w[
17
+ .gitignore
18
+ Gemfile
19
+ fastlane/.env.beta
20
+ fastlane/.env.ios
21
+ fastlane/.env.mac
22
+ fastlane/.env.release
23
+ fastlane/Appfile
24
+ fastlane/Fastfile
25
+ fastlane/Snapfile
26
+ ].each do |file|
27
+ copy_file file
28
+ end
22
29
  end
30
+
31
+ # TODO: run deliver init and overwrite with Deliverfile
23
32
  end
24
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XcodeFastlane
4
- VERSION = "1.0.3"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "xcode_fastlane/version"
4
+ require "git"
4
5
  require "xcodeproj"
5
6
 
6
7
  # Main module for helper methods and CLI.
@@ -10,6 +11,18 @@ module XcodeFastlane
10
11
  @project ||= Xcodeproj::Project.open(Pathname.glob("../*.xcodeproj").first)
11
12
  end
12
13
 
14
+ # Returns the first target
15
+ def self.target
16
+ project.targets.first
17
+ end
18
+
19
+ # Generates an SKU
20
+ # Requires environment: PRODUCE_PLATFORM to be set.
21
+ def self.sku
22
+ platform = ENV.fetch("PRODUCE_PLATFORM")
23
+ CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) + ".#{platform}"
24
+ end
25
+
13
26
  # Returns product bundle identifier for the given target or the first one found, if target_name is nil.
14
27
  #
15
28
  # Arguments:
@@ -25,4 +38,10 @@ module XcodeFastlane
25
38
  product = project.products.select { |p| p.explicit_file_type == "wrapper.application" }.first
26
39
  product.path.split(".").first
27
40
  end
41
+
42
+ # Creates and checks out a new branch
43
+ def self.checkout_branch(name)
44
+ git = Git.open(".")
45
+ git.branch(name).checkout
46
+ end
28
47
  end
File without changes
@@ -0,0 +1,5 @@
1
+ PRODUCE_LANGUAGE = en-US
2
+ PRODUCE_PLATFORM = ios
3
+ PRODUCE_SKU = ${APP_IDENTIFIER}.ios
4
+ MATCH_PLATFORM = ios
5
+ DELIVER_PLATFORM = ios
@@ -0,0 +1,5 @@
1
+ PRODUCE_LANGUAGE = en-US
2
+ PRODUCE_PLATFORM = macos
3
+ PRODUCE_SKU = ${APP_IDENTIFIER}.macos
4
+ MATCH_PLATFORM = macos
5
+ DELIVER_PLATFORM = osx
File without changes
@@ -1,14 +1,16 @@
1
1
  require "xcode_fastlane"
2
2
 
3
3
  mandatory_environment = %w[
4
- APPSTORE_CONNECT_API_KEY_ID
5
- APPSTORE_CONNECT_API_KEY_ISSUER_ID
6
- APPSTORE_CONNECT_API_KEY_P8
4
+ APP_STORE_CONNECT_KEY_KEY_ID
5
+ APP_STORE_CONNECT_KEY_ISSUER_ID
6
+ APP_STORE_CONNECT_KEY_KEY
7
7
  FASTLANE_REVIEW_EMAIL
8
8
  FASTLANE_REVIEW_FIRSTNAME
9
9
  FASTLANE_REVIEW_LASTNAME
10
10
  FASTLANE_REVIEW_PHONE
11
+ FASTLANE_TEAM_ID
11
12
  FASTLANE_USER
13
+ GITHUB_API_TOKEN
12
14
  ]
13
15
  # Optional:
14
16
  # FASTLANE_SLACK_URL
@@ -25,11 +27,14 @@ mandatory_environment.each do |var|
25
27
  ENV[var] or abort "Missing environment variable: #{var}"
26
28
  end
27
29
 
28
- app_identifier(ENV["CI_BUNDLE_ID"] || XcodeFastlane.product_bundle_id)
30
+ ENV["APP_IDENTIFIER"] = ENV["CI_BUNDLE_ID"] || XcodeFastlane.product_bundle_id
29
31
  ENV["PRODUCT_NAME"] = ENV["CI_PRODUCT"] || XcodeFastlane.product_name
30
32
  ENV["APP_NAME"] = ENV["PRODUCT_NAME"]
31
33
  ENV["IOS_IPA_OUTPUT_NAME"] = ENV["PRODUCT_NAME"]
32
34
  ENV["IOS_SCHEME"] = ENV["CI_XCODE_SCHEME"] || XcodeFastlane.product_name
35
+ ENV["RELEASE_BRANCH_PREFIX"] = "releases/"
36
+
37
+ app_identifier(ENV["APP_IDENTIFIER"])
33
38
 
34
39
  # For more information about the Appfile, see:
35
40
  # https://docs.fastlane.tools/advanced/#appfile
@@ -3,5 +3,14 @@
3
3
  # The Deliverfile allows you to store various App Store Connect metadata
4
4
  # For more information, check out the docs
5
5
  # https://docs.fastlane.tools/actions/deliver/
6
- username(ENV.fetch("FASTLANE_USER", nil))
6
+ app_review_information(
7
+ first_name: ENV["FASTLANE_REVIEW_FIRSTNAME"],
8
+ last_name: ENV["FASTLANE_REVIEW_LASTNAME"],
9
+ phone_number: ENV["FASTLANE_REVIEW_PHONE"],
10
+ email_address: ENV["FASTLANE_REVIEW_EMAIL"]
11
+ )
12
+ copyright("#{Time.now.year} #{ENV["FASTLANE_REVIEW_FIRSTNAME"]} #{ENV["FASTLANE_REVIEW_LASTNAME"]}")
7
13
  languages(%w[en-US de-DE])
14
+ precheck_default_rule_level(:error)
15
+ precheck_include_in_app_purchases(:false)
16
+ username(ENV.fetch("FASTLANE_USER", nil))
metadata CHANGED
@@ -1,15 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode_fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karsten Silkenbäumer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-14 00:00:00.000000000 Z
11
+ date: 2024-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dotenv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.1.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: git
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.0'
13
47
  - !ruby/object:Gem::Dependency
14
48
  name: thor
15
49
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +98,10 @@ files:
64
98
  - templates/Gemfile
65
99
  - templates/ci_scripts/ci_post_clone.sh
66
100
  - templates/ci_scripts/ci_post_xcodebuild.sh
101
+ - templates/fastlane/.env.beta
102
+ - templates/fastlane/.env.ios
103
+ - templates/fastlane/.env.mac
104
+ - templates/fastlane/.env.release
67
105
  - templates/fastlane/Appfile
68
106
  - templates/fastlane/Deliverfile
69
107
  - templates/fastlane/Fastfile