Skip to content

Commit d8481ba

Browse files
katipallyCopilot
andcommitted
fix(ci): strip trailing whitespace from .p8 lines
The last line of the APP_STORE_CONNECT_PRIVATE_KEY secret had trailing spaces (e.g. '-----END PRIVATE KEY----- '), which caused CryptoKit.CryptoKitASN1Error.invalidPEMDocument — CryptoKit's PEM parser requires the -----END...----- footer with no trailing whitespace. sed 's/[[:space:]]*$$//' strips trailing whitespace from every line before writing the key file, fixing the issue regardless of how the secret was pasted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ad280c3 commit d8481ba

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

.github/workflows/ios-testflight.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ jobs:
123123
124124
# Auto-detect: raw PEM (starts with -----BEGIN) or base64-encoded.
125125
if printf '%s' "$API_KEY" | head -c 20 | grep -q "^-----BEGIN"; then
126-
# Raw PEM — strip carriage returns (Windows \r\n → \n) then write.
127-
printf '%s' "$API_KEY" | tr -d '\r' > "$KEY_FILE"
126+
# Raw PEM — strip carriage returns and trailing whitespace per line
127+
# (CryptoKit rejects trailing spaces on -----END PRIVATE KEY-----).
128+
printf '%s' "$API_KEY" | tr -d '\r' | sed 's/[[:space:]]*$//' > "$KEY_FILE"
128129
echo "Detected raw PEM format"
129130
else
130131
# Base64-encoded .p8 — decode then strip carriage returns.

0 commit comments

Comments
 (0)