Skip to content

Commit 7c072d8

Browse files
authored
fix: support for special characters in profiles names (#19)
* add support form special char in the profiles names * use printf to support special characters * fix: use variable to support multiline string * fix: add quotes in resign paths * chore: fix formatting * chore: fix fomatting
1 parent 60cc269 commit 7c072d8

1 file changed

Lines changed: 35 additions & 31 deletions

File tree

action.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ runs:
9898
fi
9999
fi
100100
101-
102101
# Legacy provisioning profile validation (only when not using provisioning-profiles)
103-
if [ -z "${{ inputs.provisioning-profiles }}" ]; then
102+
PROVISIONING_PROFILES='${{ inputs.provisioning-profiles }}'
103+
if [ -z "$PROVISIONING_PROFILES" ]; then
104104
if [ -n "${{ inputs.provisioning-profile-file }}" ] && [ -n "${{ inputs.provisioning-profile-base64 }}" ]; then
105105
echo "Cannot specify both 'provisioning-profile-file' and 'provisioning-profile-base64'. Use one or the other."
106106
exit 1
@@ -118,46 +118,45 @@ runs:
118118
fi
119119
fi
120120
fi
121-
121+
122122
# Check if either provisioning-profile-name or provisioning-profiles is provided
123-
if [ -z "${{ inputs.provisioning-profile-name }}" ] && [ -z "${{ inputs.provisioning-profiles }}" ]; then
123+
if [ -z "${{ inputs.provisioning-profile-name }}" ] && [ -z "$PROVISIONING_PROFILES" ]; then
124124
echo "Either 'provisioning-profile-name' or 'provisioning-profiles' is required for device builds."
125125
exit 1
126126
fi
127-
128-
if [ -n "${{ inputs.provisioning-profile-name }}" ] && [ -n "${{ inputs.provisioning-profiles }}" ]; then
127+
128+
if [ -n "${{ inputs.provisioning-profile-name }}" ] && [ -n "$PROVISIONING_PROFILES" ]; then
129129
echo "Cannot specify both 'provisioning-profile-name' and 'provisioning-profiles'. Use one or the other."
130130
exit 1
131131
fi
132132
133-
134133
# Validate provisioning profiles if provided
135-
if [ -n "${{ inputs.provisioning-profiles }}" ]; then
136-
while read -r profile; do
137-
name=$(echo "$profile" | jq -r '.name')
138-
file_path=$(echo "$profile" | jq -r '.file // empty')
139-
base64_content=$(echo "$profile" | jq -r '.base64 // empty')
134+
if [ -n "$PROVISIONING_PROFILES" ]; then
135+
while IFS= read -r profile; do
136+
name="$(echo "$profile" | jq -r '.name')"
137+
file_path="$(echo "$profile" | jq -r '.file // empty')"
138+
base64_content="$(echo "$profile" | jq -r '.base64 // empty')"
140139
141140
if [ -z "$name" ]; then
142141
echo "Provisioning profile missing 'name' field"
143142
exit 1
144143
fi
145144
146145
if [ -n "$file_path" ] && [ -n "$base64_content" ]; then
147-
echo "Cannot specify both 'file' and 'base64' for profile '$name'"
146+
printf "Cannot specify both 'file' and 'base64' for profile: %s\n" "$name"
148147
exit 1
149148
fi
150149
151150
if [ -z "$file_path" ] && [ -z "$base64_content" ]; then
152-
echo "Either 'file' or 'base64' is required for profile '$name'"
151+
printf "Either 'file' or 'base64' is required for profile: %s\n" "$name"
153152
exit 1
154153
fi
155154
156155
if [ -n "$file_path" ] && [ ! -f "$file_path" ]; then
157-
echo "Provisioning profile file not found: '$file_path'"
156+
printf "Provisioning profile file not found: %s\n" "$file_path"
158157
exit 1
159158
fi
160-
done < <(echo "${{ inputs.provisioning-profiles }}" | jq -c '.[]')
159+
done < <(echo "$PROVISIONING_PROFILES" | jq -c '.[]')
161160
fi
162161
fi
163162
shell: bash
@@ -230,6 +229,9 @@ runs:
230229
- name: Setup Code Signing (device builds only)
231230
if: ${{ inputs.re-sign == 'true' && inputs.destination == 'device' || (!env.ARTIFACT_URL && inputs.destination == 'device') }}
232231
run: |
232+
# Store provisioning profiles input
233+
PROVISIONING_PROFILES='${{ inputs.provisioning-profiles }}'
234+
233235
# Create temporary keychain
234236
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
235237
@@ -238,7 +240,6 @@ runs:
238240
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
239241
fi
240242
241-
242243
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
243244
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
244245
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
@@ -299,11 +300,11 @@ runs:
299300
fi
300301
301302
# Setup provisioning profiles
302-
if [ -n "${{ inputs.provisioning-profiles }}" ]; then
303-
while read -r profile; do
304-
name=$(echo "$profile" | jq -r '.name')
305-
file_path=$(echo "$profile" | jq -r '.file // empty')
306-
base64_content=$(echo "$profile" | jq -r '.base64 // empty')
303+
if [ -n "$PROVISIONING_PROFILES" ]; then
304+
while IFS= read -r profile; do
305+
name="$(echo "$profile" | jq -r '.name')"
306+
file_path="$(echo "$profile" | jq -r '.file // empty')"
307+
base64_content="$(echo "$profile" | jq -r '.base64 // empty')"
307308
308309
ADDITIONAL_PROFILE_PATH="$PROFILE_DIR/${name}.mobileprovision"
309310
@@ -313,8 +314,8 @@ runs:
313314
echo -n "$base64_content" | base64 --decode -o "$ADDITIONAL_PROFILE_PATH"
314315
fi
315316
316-
echo "Installed provisioning profile: $name"
317-
done < <(echo "${{ inputs.provisioning-profiles }}" | jq -c '.[]')
317+
printf "Installed provisioning profile: %s\n" "$name"
318+
done < <(echo "$PROVISIONING_PROFILES" | jq -c '.[]')
318319
fi
319320
shell: bash
320321

@@ -388,7 +389,7 @@ runs:
388389
- name: Re-sign IPA
389390
if: ${{ env.ARTIFACT_URL && inputs.destination == 'device' && inputs.re-sign == 'true' }}
390391
run: |
391-
npx rock sign:ios ${{ env.ARTIFACT_PATH }} \
392+
npx rock sign:ios "${{ env.ARTIFACT_PATH }}" \
392393
--build-jsbundle \
393394
--identity ${{ env.IDENTITY }}
394395
shell: bash
@@ -397,7 +398,7 @@ runs:
397398
- name: Re-bundle APP
398399
if: ${{ env.ARTIFACT_URL && inputs.destination == 'simulator' && inputs.re-sign == 'true' }}
399400
run: |
400-
npx rock sign:ios ${{ env.ARTIFACT_TAR_PATH }} \
401+
npx rock sign:ios "${{ env.ARTIFACT_TAR_PATH }}" \
401402
--build-jsbundle \
402403
--app
403404
shell: bash
@@ -474,6 +475,9 @@ runs:
474475
- name: Clean Up Code Signing (device builds only)
475476
if: ${{ inputs.re-sign == 'true' && inputs.destination == 'device' || (!env.ARTIFACT_URL && inputs.destination == 'device') }}
476477
run: |
478+
# Store provisioning profiles input
479+
PROVISIONING_PROFILES='${{ inputs.provisioning-profiles }}'
480+
477481
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
478482
security delete-keychain "$KEYCHAIN_PATH"
479483
@@ -488,14 +492,14 @@ runs:
488492
fi
489493
490494
# Clean up provisioning profiles
491-
if [ -n "${{ inputs.provisioning-profiles }}" ]; then
495+
if [ -n "$PROVISIONING_PROFILES" ]; then
492496
PROFILE_DIR="$HOME/Library/MobileDevice/Provisioning Profiles"
493-
while read -r profile; do
494-
name=$(echo "$profile" | jq -r '.name')
497+
while IFS= read -r profile; do
498+
name="$(echo "$profile" | jq -r '.name')"
495499
PROFILE_PATH="$PROFILE_DIR/${name}.mobileprovision"
496500
rm "$PROFILE_PATH"
497-
echo "Cleaned up additional provisioning profile: $name"
498-
done < <(echo "${{ inputs.provisioning-profiles }}" | jq -c '.[]')
501+
printf "Cleaned up provisioning profile: %s\n" "$name"
502+
done < <(echo "$PROVISIONING_PROFILES" | jq -c '.[]')
499503
fi
500504
shell: bash
501505

0 commit comments

Comments
 (0)