You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update CI
* mock sdk version
* modify sdk version
* Update podfile
* [FIX] windows version
---------
Co-authored-by: qinhui <>
Co-authored-by: HeZhengQing <hezhengqing@agora.io>
echo"Branch from CI_COMMIT_REF_NAME: $branch_name">&2
88
-
# Method 2: Try git command
89
-
else
90
-
branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
91
-
if [ "$branch_name"="HEAD" ];then
92
-
# In detached HEAD state, try to get branch from remote
93
-
branch_name=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///')
94
-
echo"Branch from git branch -r: $branch_name">&2
95
-
else
96
-
echo"Branch from git rev-parse: $branch_name">&2
97
-
fi
98
-
fi
99
-
100
-
# Remove origin/ prefix if present (but keep the rest of the path)
101
-
branch_name=$(echo "$branch_name"| sed 's/^origin\///')
102
-
103
-
echo"$branch_name"
104
-
}
105
-
106
-
# Function: Validate project MARKETING_VERSION against branch version
107
-
validate_project_version() {
108
-
local project_path="$1"
109
-
local project_name="$2"
110
-
local branch_version="$3"
111
-
112
-
echo"-----------------------------------"
113
-
echo"Validating project version: $project_path"
114
-
115
-
local pbxproj_file="${project_path}/${project_name}.xcodeproj/project.pbxproj"
116
-
117
-
if [ !-f"$pbxproj_file" ];then
118
-
echo"Error: project.pbxproj file not found: $pbxproj_file"
119
-
return 1
120
-
fi
121
-
122
-
# Extract MARKETING_VERSION for main target (skip Extension targets)
123
-
local plist_version=$(grep -A 2 "@executable_path/Frameworks""$pbxproj_file"| grep "MARKETING_VERSION"| head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/'| tr -d '')
124
-
125
-
if [ -z"$plist_version" ];then
126
-
echo"Error: Unable to read MARKETING_VERSION from project.pbxproj"
127
-
return 1
128
-
fi
129
-
130
-
echo"Project version: $plist_version"
131
-
132
-
# Compare versions
133
-
if [ "$branch_version"!="$plist_version" ];then
134
-
echo""
135
-
echo"=========================================="
136
-
echo"Error: Version mismatch!"
137
-
echo"=========================================="
138
-
echo" Branch version: $branch_version"
139
-
echo" Project version: $plist_version"
140
-
echo" Project path: $project_path"
141
-
echo""
142
-
echo"Please ensure the version in branch name matches MARKETING_VERSION in Info.plist"
# Function: Validate SDK version in Podfile against branch version
152
-
validate_sdk_version() {
153
-
local podfile_path="$1"
154
-
local branch_version="$2"
155
-
156
-
echo"-----------------------------------"
157
-
echo"Validating SDK version: $podfile_path"
158
-
159
-
# Extract SDK version from Podfile (support both AgoraRtcEngine_iOS and AgoraAudio_iOS)
160
-
# Also support commented lines (lines starting with #)
161
-
local sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'AgoraRtcEngine_iOS'""$podfile_path"| sed -n "s/.*'\([0-9.]*\)'.*/\1/p"| head -1)
162
-
if [ -z"$sdk_version" ];then
163
-
sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'AgoraAudio_iOS'""$podfile_path"| sed -n "s/.*'\([0-9.]*\)'.*/\1/p"| head -1)
76
+
# Validate SDK version in Podfile (skip only for main branch)
77
+
if [ "$BRANCH_NAME"!="main" ];then
78
+
if [ -z"$BRANCH_VERSION" ];then
79
+
echo"Error: BRANCH_VERSION is not set, cannot validate SDK version"
80
+
exit 1
164
81
fi
165
82
166
-
if [ -z"$sdk_version" ];then
167
-
echo"Error: Unable to extract SDK version from Podfile"
168
-
echo"Podfile path: $podfile_path"
169
-
return 1
170
-
fi
171
-
172
-
echo"SDK version: $sdk_version"
173
-
174
-
# Compare versions
175
-
if [ "$branch_version"!="$sdk_version" ];then
176
-
echo""
177
-
echo"=========================================="
178
-
echo"Error: SDK version mismatch!"
179
-
echo"=========================================="
180
-
echo" Branch version: $branch_version"
181
-
echo" SDK version: $sdk_version"
182
-
echo" Podfile path: $podfile_path"
183
-
echo""
184
-
echo"Please ensure the SDK version in Podfile matches the branch version."
185
-
echo""
186
-
return 1
187
-
fi
188
-
189
-
echo"✓ SDK version matches: $sdk_version"
190
-
return 0
191
-
}
192
-
193
-
# Main version validation logic
194
-
echo"=========================================="
195
-
echo"Starting branch version validation..."
196
-
echo"=========================================="
197
-
198
-
BRANCH_NAME=$(get_branch_name)
199
-
200
-
if [ -z"$BRANCH_NAME" ] || [ "$BRANCH_NAME"="HEAD" ];then
201
-
echo"Warning: Unable to get Git branch name, skipping version validation"
202
-
BRANCH_VERSION=""
203
-
else
204
-
echo"Current branch: $BRANCH_NAME"
205
-
206
-
# Extract version from branch name (format: dev/x.x.x)
207
-
if [[ $BRANCH_NAME=~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]];then
# Extract SDK version from Podfile (support both AgoraRtcEngine_iOS and AgoraAudio_iOS)
278
-
# Also support commented lines
279
-
sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'AgoraRtcEngine_iOS'" ./iOS/${ios_direction}/Podfile | sed -n "s/.*'\([0-9.]*\)'.*/\1/p"| head -1)
280
-
if [ -z"$sdk_version" ];then
281
-
sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'AgoraAudio_iOS'" ./iOS/${ios_direction}/Podfile | sed -n "s/.*'\([0-9.]*\)'.*/\1/p"| head -1)
282
-
fi
283
-
echo"sdk_version: $sdk_version"
284
-
285
-
# Validate SDK version matches branch version (if on dev/x.x.x branch)
0 commit comments