xcode_fastlane 1.1.0 → 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: bc2bdae8df94b0ec1d5737ab0fc0a942ff03203dedd277c185b5d3fb8ccfe04c
4
- data.tar.gz: 2a47d93c0f454c7c1b0fa3252b469577ddbbe9ef4bfcc90c93b96c9a9405c496
3
+ metadata.gz: 2e2663ea7a9423640263850234ef3e7d77e90ed560f0e3c075370ee1c090c2cc
4
+ data.tar.gz: 4cfa19a676af15c29b0bcc853e0b38ed73b4c2bb77d846323e500cb0bf65fda7
5
5
  SHA512:
6
- metadata.gz: 305bc42811f91a1857ffcf3730d8a120990a304b52aeebce623357339adb3af815bd1fc09a6aed584fc0890303464af2a1d1a7a71f43bc378688f300dddbc2fe
7
- data.tar.gz: 77fbb984e323fb95c7c11c812eb4ecaba4cb8d3dc172612e8955e5bc2b187f892adb157251c107a58fa163761e71a09ad607cfb3da54577ec33a054d979e3804
6
+ metadata.gz: 93dbf3ec6a82312fa73341ce2ae406ebe2f33e27f8958c512386f5ede94572ec8124e864dad04737a0dcbdde133053846e38b3e6f3c6e5ca36ce51394a64e4dd
7
+ data.tar.gz: f9071ea3c917e26da59a39ff2332117a819c6cdfba7e6c9845637241c65947de7a3bfd7105c19d29139570f4bcfc59cf0e42300c70db072ee78950d4c132dd6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.2.0 (2024-05-21)
2
+
3
+ ### Features
4
+
5
+ - new fastfile with proper lane setup
6
+
1
7
  ## 1.1.0 (2024-05-17)
2
8
 
3
9
  ### Features
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.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -11,6 +11,18 @@ module XcodeFastlane
11
11
  @project ||= Xcodeproj::Project.open(Pathname.glob("../*.xcodeproj").first)
12
12
  end
13
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
+
14
26
  # Returns product bundle identifier for the given target or the first one found, if target_name is nil.
15
27
  #
16
28
  # Arguments:
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,57 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcode_fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
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-17 00:00:00.000000000 Z
11
+ date: 2024-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
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
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: '1.3'
39
+ version: '2.0'
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: '1.3'
46
+ version: '2.0'
27
47
  - !ruby/object:Gem::Dependency
28
- name: xcodeproj
48
+ name: thor
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
51
  - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '1.24'
53
+ version: '1.3'
34
54
  type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '1.24'
60
+ version: '1.3'
41
61
  - !ruby/object:Gem::Dependency
42
- name: git
62
+ name: xcodeproj
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '2.0'
67
+ version: '1.24'
48
68
  type: :runtime
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '2.0'
74
+ version: '1.24'
55
75
  description: Provides init script, templates and functions to be used within fastlane
56
76
  files.
57
77
  email:
@@ -78,6 +98,10 @@ files:
78
98
  - templates/Gemfile
79
99
  - templates/ci_scripts/ci_post_clone.sh
80
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
81
105
  - templates/fastlane/Appfile
82
106
  - templates/fastlane/Deliverfile
83
107
  - templates/fastlane/Fastfile