fix(ioscompanion): resolve signing key path to absolute

xcodebuild's -authenticationKeyPath requires an absolute path, but .env
files commonly carry a repo-relative one. Resolve it against the working
directory before the stat so a relative ASC_API_KEY_PATH still signs.
This commit is contained in:
pj committed 2026-06-08 23:29:52 +05:30
1 parent 0e76e2e474
commit 1357a2b1cc
2 files changed
+27 -4

No files matched your search

+8 -4
View File
@@ -67,10 +67,14 @@ func readSigningCredentials() (signingCredentials, error) {
if len(missing) > 0 {
return creds, fmt.Errorf("device signing requires environment variables: %s", strings.Join(missing, ", "))
}
if creds.authKeyPath != "" {
if _, err := os.Stat(creds.authKeyPath); err != nil {
return creds, fmt.Errorf("App Store Connect key not found at %s: %w", creds.authKeyPath, err)
}
// xcodebuild's -authenticationKeyPath demands an absolute path, but .env
// files commonly carry a repo-relative one. Resolve it against the working
// directory before the stat so a relative key still works.
if absolute, err := filepath.Abs(creds.authKeyPath); err == nil {
creds.authKeyPath = absolute
}
if _, err := os.Stat(creds.authKeyPath); err != nil {
return creds, fmt.Errorf("App Store Connect key not found at %s: %w", creds.authKeyPath, err)
}
return creds, nil
}