[ci-bitrise] Fix apikey.json generation to escape multi-line PEM content
ASC_KEY_CONTENT is the raw .p8 private key, which contains literal newlines. The heredoc interpolated it straight into a JSON string, producing invalid JSON (JSON::ParserError in get_provisioning_profile). Build the file with Ruby's JSON encoder instead so newlines are escaped correctly. Verified locally against a realistic multi-line PEM value.
This commit is contained in:
30
bitrise.yml
30
bitrise.yml
@@ -43,9 +43,18 @@ workflows:
|
|||||||
inputs:
|
inputs:
|
||||||
- content: |
|
- content: |
|
||||||
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig"
|
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig"
|
||||||
cat > "$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json" <<EOF
|
# ASC_KEY_CONTENT is the raw multi-line .p8 PEM content — build
|
||||||
{"key_id":"$ASC_KEY_ID","issuer_id":"$ASC_ISSUER_ID","key":"$ASC_KEY_CONTENT","in_house":false}
|
# the JSON with Ruby's encoder so its embedded newlines get
|
||||||
EOF
|
# escaped correctly instead of breaking the JSON string.
|
||||||
|
export APIKEY_PATH="$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json"
|
||||||
|
ruby -rjson -e '
|
||||||
|
File.write(ENV["APIKEY_PATH"], JSON.generate({
|
||||||
|
"key_id" => ENV["ASC_KEY_ID"],
|
||||||
|
"issuer_id" => ENV["ASC_ISSUER_ID"],
|
||||||
|
"key" => ENV["ASC_KEY_CONTENT"],
|
||||||
|
"in_house" => false
|
||||||
|
}))
|
||||||
|
'
|
||||||
- fastlane@3:
|
- fastlane@3:
|
||||||
inputs:
|
inputs:
|
||||||
- lane: beta
|
- lane: beta
|
||||||
@@ -77,9 +86,18 @@ workflows:
|
|||||||
inputs:
|
inputs:
|
||||||
- content: |
|
- content: |
|
||||||
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig"
|
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig"
|
||||||
cat > "$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json" <<EOF
|
# ASC_KEY_CONTENT is the raw multi-line .p8 PEM content — build
|
||||||
{"key_id":"$ASC_KEY_ID","issuer_id":"$ASC_ISSUER_ID","key":"$ASC_KEY_CONTENT","in_house":false}
|
# the JSON with Ruby's encoder so its embedded newlines get
|
||||||
EOF
|
# escaped correctly instead of breaking the JSON string.
|
||||||
|
export APIKEY_PATH="$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json"
|
||||||
|
ruby -rjson -e '
|
||||||
|
File.write(ENV["APIKEY_PATH"], JSON.generate({
|
||||||
|
"key_id" => ENV["ASC_KEY_ID"],
|
||||||
|
"issuer_id" => ENV["ASC_ISSUER_ID"],
|
||||||
|
"key" => ENV["ASC_KEY_CONTENT"],
|
||||||
|
"in_house" => false
|
||||||
|
}))
|
||||||
|
'
|
||||||
- fastlane@3:
|
- fastlane@3:
|
||||||
inputs:
|
inputs:
|
||||||
- lane: release
|
- lane: release
|
||||||
|
|||||||
Reference in New Issue
Block a user