Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 61 additions & 9 deletions .github/scripts/update_podspec_version.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,67 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail

file="razorpay-pod.podspec" #the file where you keep your string name
NEW_PODSPEC_VERSION="${1:?missing podspec version}"
PODSPEC_PATH="razorpay-pod.podspec"
RESOLVED_CORE_VERSION="${CORE_VERSION:-}"

NEW_PODSPEC_VERSION=$1
if [ ! -f "${PODSPEC_PATH}" ]; then
echo "❌ Podspec not found: ${PODSPEC_PATH}"
exit 1
fi

myUser="$(grep 's.version ' $file)"
lastVal=${myUser##* }
CURRENT_VERSION=$(awk -F"'" '/^[[:space:]]*s\.version[[:space:]]*=/{print $2; exit}' "${PODSPEC_PATH}")
if [ -z "${CURRENT_VERSION}" ]; then
echo "❌ Could not read current podspec version"
exit 1
fi

sed -i -e "s/$lastVal/'$NEW_PODSPEC_VERSION'/g" $file
TEMP_PODSPEC="$(mktemp)"
awk -v new_version="${NEW_PODSPEC_VERSION}" '
/^[[:space:]]*s\.version[[:space:]]*=/ {
sub(/\047[^'\''"]+\047/, "\047" new_version "\047")
}
{ print }
' "${PODSPEC_PATH}" > "${TEMP_PODSPEC}"
mv "${TEMP_PODSPEC}" "${PODSPEC_PATH}"

echo "$lastVal"
echo "${CURRENT_VERSION}"

# echo "$myUser" | awk '{print $NF}'

if [ -n "${RESOLVED_CORE_VERSION}" ]; then
DEPENDENCY_LINE=" s.dependency 'razorpay-core-pod' , '${RESOLVED_CORE_VERSION}'"
TEMP_PODSPEC="$(mktemp)"

if grep -q "razorpay-core-pod" "${PODSPEC_PATH}"; then
awk -v dependency_line="${DEPENDENCY_LINE}" '
/^[[:space:]]*s\.dependency[[:space:]]+'\''razorpay-core-pod'\''/ {
print dependency_line
replaced = 1
next
}
{ print }
END {
if (!replaced) {
exit 1
}
}
' "${PODSPEC_PATH}" > "${TEMP_PODSPEC}"
else
awk -v dependency_line="${DEPENDENCY_LINE}" '
/^[[:space:]]*s\.vendored_frameworks[[:space:]]*=/ {
print
print dependency_line
inserted = 1
next
}
{ print }
END {
if (!inserted) {
exit 1
}
}
' "${PODSPEC_PATH}" > "${TEMP_PODSPEC}"
fi

mv "${TEMP_PODSPEC}" "${PODSPEC_PATH}"
echo "✅ razorpay-pod configured to depend on razorpay-core-pod ${RESOLVED_CORE_VERSION}"
fi
1 change: 1 addition & 0 deletions .github/workflows/deploy-standard-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
DEPLOYMENT_VERSION: ${{ github.event.client_payload.version || '' }}
IS_RC: ${{ github.event.client_payload.is_rc || '' }}
CORE_CHANGED: ${{ github.event.client_payload.core_changed || 'false' }}
CORE_VERSION: ${{ github.event.client_payload.core_version || '' }}
ARTIFACT_REPOSITORY: ${{ github.event.client_payload.source_repo || '' }}
ARTIFACT_RUN_ID: ${{ github.event.client_payload.run_id || '' }}
SDK_ARTIFACT: ${{ github.event.client_payload.artifacts.sdk || '' }}
Expand Down