Skip to content

Commit

Permalink
Update upload_pod_archive_and_update_podspec.sh to take path pattern (m…
Browse files Browse the repository at this point in the history
…icrosoft#16810)

Update upload_pod_archive_and_update_podspec.sh to take a pod archive path glob pattern. The actual pod archive path has a version suffix which changes.
  • Loading branch information
edgchen1 authored Jul 25, 2023
1 parent 38db5ec commit e01365f
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@

# Note: This script is intended to be called from the iOS CocoaPods package release pipeline or a similar context.

set -e
set -x

USAGE_TEXT="Usage: ${0} <path to pod archive> <path to podspec>"
IFS='' read -d '' -r USAGE_TEXT <<USAGE
Usage: ${0} <pod archive path glob pattern> <podspec path>
Example pod archive path glob pattern: "./pod-archive-*.zip"
Quote the pattern to avoid shell expansion.
USAGE

set -e

abspath() {
local INPUT_PATH=${1:?"Expected path as the first argument."}
echo "$(cd "$(dirname "${INPUT_PATH}")" && pwd)/$(basename "${INPUT_PATH}")"
}

POD_ARCHIVE_PATH=$(abspath "${1:?${USAGE_TEXT}}")
POD_ARCHIVE_PATH_PATTERN=${1:?${USAGE_TEXT}}
PODSPEC_PATH=$(abspath "${2:?${USAGE_TEXT}}")

# expand pod archive path pattern to exactly one path
POD_ARCHIVE_PATHS=()
while IFS='' read -r line; do POD_ARCHIVE_PATHS+=("$line"); done < <( compgen -G "${POD_ARCHIVE_PATH_PATTERN}" )
if [[ "${#POD_ARCHIVE_PATHS[@]}" -ne "1" ]]; then
echo "Did not find exactly one pod archive file."
exit 1
fi

POD_ARCHIVE_PATH=$(abspath "${POD_ARCHIVE_PATHS[0]}")
POD_ARCHIVE_BASENAME=$(basename "${POD_ARCHIVE_PATH}")

STORAGE_ACCOUNT_NAME="onnxruntimepackages"
Expand Down

0 comments on commit e01365f

Please sign in to comment.