|
|
|
|
@@ -12,6 +12,7 @@ CI_KEYCHAIN_DB_PATH = File.expand_path("~/Library/Keychains/#{CI_KEYCHAIN_NAME}-
|
|
|
|
|
IOS_ROOT = File.expand_path("..", __dir__)
|
|
|
|
|
PROJECT_FILE = File.join(IOS_ROOT, "Sybil.xcodeproj")
|
|
|
|
|
PROJECT_SPEC = File.join(IOS_ROOT, "project.yml")
|
|
|
|
|
APP_PROJECT_SPEC = File.join(IOS_ROOT, "Apps/Sybil/project.yml")
|
|
|
|
|
|
|
|
|
|
def present?(value)
|
|
|
|
|
!value.to_s.strip.empty?
|
|
|
|
|
@@ -24,14 +25,15 @@ end
|
|
|
|
|
def release_version
|
|
|
|
|
tag = ENV["SYBIL_VERSION_TAG"]
|
|
|
|
|
tag = ENV["GITHUB_REF_NAME"] if !present?(tag)
|
|
|
|
|
tag = ENV["GITHUB_REF"].to_s.sub(%r{\Arefs/tags/}, "") if !present?(tag)
|
|
|
|
|
tag = sh("git describe --tags --abbrev=0").strip if !present?(tag)
|
|
|
|
|
version = tag.to_s.sub(%r{\Arelease/}, "").sub(/\Av/, "")
|
|
|
|
|
match = tag.to_s.match(%r{\Arelease/ios/v(\d+\.\d+\.\d+)\z})
|
|
|
|
|
|
|
|
|
|
unless version.match?(/\A\d+\.\d+\.\d+\z/)
|
|
|
|
|
UI.user_error!("Release tag must look like v1.2.3; got #{tag.inspect}")
|
|
|
|
|
unless match
|
|
|
|
|
UI.user_error!("Release tag must look like release/ios/v1.2.3; got #{tag.inspect}")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
version
|
|
|
|
|
match[1]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# App Store Connect requires CFBundleVersion to be unique and strictly
|
|
|
|
|
@@ -48,6 +50,17 @@ def build_number
|
|
|
|
|
value.to_i
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def stamp_marketing_version(version)
|
|
|
|
|
contents = File.read(APP_PROJECT_SPEC)
|
|
|
|
|
updated = contents.sub(/^(\s*MARKETING_VERSION:\s*).*/, "\\1\"#{version}\"")
|
|
|
|
|
|
|
|
|
|
if updated == contents
|
|
|
|
|
UI.user_error!("Could not find MARKETING_VERSION in #{APP_PROJECT_SPEC}")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
File.write(APP_PROJECT_SPEC, updated)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
platform :ios do
|
|
|
|
|
private_lane :app_store_api_key do
|
|
|
|
|
app_store_connect_api_key(
|
|
|
|
|
@@ -103,9 +116,11 @@ platform :ios do
|
|
|
|
|
|
|
|
|
|
api_key = app_store_api_key
|
|
|
|
|
|
|
|
|
|
version = release_version
|
|
|
|
|
stamp_marketing_version(version)
|
|
|
|
|
sh("xcodegen", "--spec", PROJECT_SPEC)
|
|
|
|
|
|
|
|
|
|
increment_version_number(version_number: release_version, xcodeproj: PROJECT_FILE)
|
|
|
|
|
increment_version_number(version_number: version, xcodeproj: PROJECT_FILE)
|
|
|
|
|
increment_build_number(build_number: build_number, xcodeproj: PROJECT_FILE)
|
|
|
|
|
|
|
|
|
|
sync_signing(api_key: api_key, readonly: true)
|
|
|
|
|
|