Skip to content

Commit e494546

Browse files
author
Krisztian Godrei
committed
ipa export fix
1 parent 7454288 commit e494546

File tree

2 files changed

+41
-52
lines changed

2 files changed

+41
-52
lines changed

export_ipa.rb

Lines changed: 0 additions & 42 deletions
This file was deleted.

step.sh

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,26 +228,57 @@ 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

240276

241277
#
242278
# Export *.ipa path
243-
set -x
244-
curr_pwd="$(pwd)"
245-
cd "${THIS_SCRIPT_DIR}"
246-
bundle exec ruby "${THIS_SCRIPT_DIR}/export_ipa.rb" \
247-
"${archive_path}" \
248-
"${output_dir}"
249-
cd "${curr_pwd}"
250-
set +x
279+
echo " (i) The IPA is now available at: ${ipa_path}"
280+
envman add --key BITRISE_IPA_PATH --value "${ipa_path}"
281+
echo ' (i) The IPA path is now available in the Environment Variable: $BITRISE_IPA_PATH'
251282

252283

253284
#

0 commit comments

Comments
 (0)