Skip to content

Commit 42704b9

Browse files
committed
apple: include correct git hash when uploading testflight build
1 parent db5c4d2 commit 42704b9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pkg/apple/fastlane/Fastfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,24 @@ end
173173

174174
private_lane :ra_upload_to_testflight do |options|
175175
if options[:upload].nil? or options[:upload]
176-
info = last_git_commit
177-
short_hash = info[:abbreviated_commit_hash]
176+
short_hash = nil
177+
version_file = File.expand_path("../../../.git_version.h", Dir.pwd)
178+
if File.exist?(version_file)
179+
content = File.read(version_file)
180+
match = content.match(/#define\s+GIT_VERSION\s+([0-9a-fA-F]+)/)
181+
if match
182+
short_hash = match[1]
183+
UI.message "Using commit from .git_version.h: #{short_hash}"
184+
else
185+
UI.message ".git_version.h found but no GIT_VERSION; falling back to git"
186+
end
187+
end
188+
if short_hash.nil?
189+
info = last_git_commit
190+
short_hash = info[:abbreviated_commit_hash]
191+
UI.message "Using git commit from repo: #{short_hash}"
192+
end
193+
178194
upload_to_testflight(
179195
distribute_external: (options[:public].nil? || options[:public]),
180196
groups: options[:public].nil? || options[:public] ? ['Invaders', 'Patreons'] : [],

0 commit comments

Comments
 (0)