Skip to content

Commit 4f870c6

Browse files
committed
Merge pull request #18 from gkiki90/ipa_path
ipa path fix
2 parents 8d9d52e + e494546 commit 4f870c6

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

step.sh

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,54 @@ else
228228

229229
set -x
230230

231+
tmp_dir=$(mktemp -d)
232+
231233
xcodebuild -exportArchive \
232234
-archivePath "${archive_path}" \
233-
-exportPath "${output_dir}" \
235+
-exportPath "${tmp_dir}" \
234236
-exportOptionsPlist "${export_options_path}"
237+
238+
set +x
239+
240+
# Searching for ipa
241+
exported_ipa_path=""
242+
IFS=$'\n'
243+
for a_file_path in $(find "${tmp_dir}" -maxdepth 1 -mindepth 1)
244+
do
245+
filename=$(basename "$a_file_path")
246+
echo " -> moving file: ${a_file_path} to ${output_dir}"
247+
248+
mv "${a_file_path}" "${output_dir}"
249+
250+
regex=".*.ipa"
251+
if [[ "${filename}" =~ $regex ]]; then
252+
if [[ -z "${exported_ipa_path}" ]] ; then
253+
exported_ipa_path="${output_dir}/${filename}"
254+
else
255+
echo " (!) More then ipa file found"
256+
fi
257+
fi
258+
done
259+
unset IFS
260+
261+
if [[ -z "${exported_ipa_path}" ]] ; then
262+
echo " (!) No ipa file found"
263+
exit 1
264+
fi
265+
266+
if [ ! -e "${exported_ipa_path}" ] ; then
267+
echo " (!) Failed to move ipa to output dir"
268+
exit 1
269+
fi
270+
271+
ipa_path="${exported_ipa_path}"
235272
fi
236273

237274
set +v
238-
set +x
239275

276+
277+
#
278+
# Export *.ipa path
240279
echo " (i) The IPA is now available at: ${ipa_path}"
241280
envman add --key BITRISE_IPA_PATH --value "${ipa_path}"
242281
echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_IPA_PATH'

0 commit comments

Comments
 (0)