From a9ba710004a79753e8e4d8d37ef5bb4dc97f75e6 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Mon, 16 Jun 2025 14:58:17 -0400 Subject: [PATCH] apple: include correct git hash when uploading testflight build --- pkg/apple/fastlane/Fastfile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkg/apple/fastlane/Fastfile b/pkg/apple/fastlane/Fastfile index e2b7302d75..e4ef04dd37 100644 --- a/pkg/apple/fastlane/Fastfile +++ b/pkg/apple/fastlane/Fastfile @@ -173,8 +173,24 @@ end private_lane :ra_upload_to_testflight do |options| if options[:upload].nil? or options[:upload] - info = last_git_commit - short_hash = info[:abbreviated_commit_hash] + short_hash = nil + version_file = File.expand_path("../../../.git_version.h", Dir.pwd) + if File.exist?(version_file) + content = File.read(version_file) + match = content.match(/#define\s+GIT_VERSION\s+([0-9a-fA-F]+)/) + if match + short_hash = match[1] + UI.message "Using commit from .git_version.h: #{short_hash}" + else + UI.message ".git_version.h found but no GIT_VERSION; falling back to git" + end + end + if short_hash.nil? + info = last_git_commit + short_hash = info[:abbreviated_commit_hash] + UI.message "Using git commit from repo: #{short_hash}" + end + upload_to_testflight( distribute_external: (options[:public].nil? || options[:public]), groups: options[:public].nil? || options[:public] ? ['Invaders', 'Patreons'] : [],