From ae75403c719db9dd5cec8bd2e7c399b75c6182ff Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 10:54:26 +0800 Subject: [PATCH 1/6] feat(windows): Add Shengwang product prefix --- windows/APIExample/cloud_build.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/APIExample/cloud_build.bat b/windows/APIExample/cloud_build.bat index 59621cf6f..932f78b71 100644 --- a/windows/APIExample/cloud_build.bat +++ b/windows/APIExample/cloud_build.bat @@ -70,12 +70,12 @@ if %ERRORLEVEL% EQU 0 ( ) ) -REM Copy to WORKSPACE with original naming format +REM Copy to WORKSPACE with Shengwang product prefix set h=%time:~0,2% set h=%h: =0% if not defined WORKSPACE set WORKSPACE=%~dp0 -copy !result_zip! "%WORKSPACE%\\APIExample_windows_%BUILD_NUMBER%_%date:~4,2%%date:~7,2%%h%%time:~3,2%_Release_exe.zip" +copy !result_zip! "%WORKSPACE%\\Shengwang_APIExample_windows_%BUILD_NUMBER%_%date:~4,2%%date:~7,2%%h%%time:~3,2%_Release_exe.zip" del /F /Q !result_zip! 2>nul rmdir /S /Q Output 2>nul -echo Build and Package done. \ No newline at end of file +echo Build and Package done. From 1b975cd4c3f7ab04fa318d3bc497c50f3a5cf503 Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 13:23:15 +0800 Subject: [PATCH 2/6] fix(ci): use configured branch for iOS version validation --- .github/ci/build/build_ios.sh | 3 +- .github/ci/build/build_mac.sh | 4 ++- .github/ci/build/common_functions.sh | 45 ++++++++++++++++++--------- iOS/APIExample-Audio/cloud_build.sh | 32 +++++++++++-------- iOS/APIExample-OC/cloud_build.sh | 32 +++++++++++-------- iOS/APIExample-SwiftUI/cloud_build.sh | 32 +++++++++++-------- iOS/APIExample/cloud_build.sh | 32 +++++++++++-------- macOS/cloud_build.sh | 32 +++++++++++-------- 8 files changed, 131 insertions(+), 81 deletions(-) diff --git a/.github/ci/build/build_ios.sh b/.github/ci/build/build_ios.sh index 1d20fc91f..40a21606f 100644 --- a/.github/ci/build/build_ios.sh +++ b/.github/ci/build/build_ios.sh @@ -66,6 +66,8 @@ echo release_version: $release_version echo short_version: $short_version echo pwd: `pwd` echo sdk_url: $sdk_url +echo api_examples_shengwang_branch: $api_examples_shengwang_branch +export api_examples_shengwang_branch export https_proxy=10.10.114.55:1080 export http_proxy=10.10.114.55:1080 @@ -155,4 +157,3 @@ if [ $compile_project = true ]; then ./cloud_build.sh || exit 1 cd - fi - diff --git a/.github/ci/build/build_mac.sh b/.github/ci/build/build_mac.sh index 6f215b93d..341c61987 100644 --- a/.github/ci/build/build_mac.sh +++ b/.github/ci/build/build_mac.sh @@ -51,6 +51,8 @@ echo release_version: $release_version echo short_version: $short_version echo pwd: `pwd` echo sdk_url: $sdk_url +echo api_examples_shengwang_branch: $api_examples_shengwang_branch +export api_examples_shengwang_branch export https_proxy=10.10.114.55:1080 export http_proxy=10.10.114.55:1080 @@ -144,4 +146,4 @@ fi # cd ./$unzip_name/samples/APIExample # ./cloud_build.sh || exit 1 # cd - -#fi \ No newline at end of file +#fi diff --git a/.github/ci/build/common_functions.sh b/.github/ci/build/common_functions.sh index a4bef08dd..55fd6774a 100755 --- a/.github/ci/build/common_functions.sh +++ b/.github/ci/build/common_functions.sh @@ -3,14 +3,33 @@ # Common functions for iOS/macOS build scripts # This file contains reusable functions for version validation +# Function: Normalize branch references to plain branch names +# Returns: Branch name without common ref prefixes +normalize_branch_name() { + local branch_name="$1" + + branch_name=$(echo "$branch_name" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') + + echo "$branch_name" +} + # Function: Get current git branch name # Tries multiple methods to determine the branch name in CI environments -# Returns: Branch name (without origin/ prefix) +# Returns: Branch name without common ref prefixes get_branch_name() { local branch_name="" - # Method 1: Try environment variables (Jenkins/GitLab CI) - if [ ! -z "$GIT_BRANCH" ]; then + # Method 1: Try the explicit Jenkins branch parameter first. + # Jenkins checks out a detached HEAD, so inferring from branches containing + # HEAD can pick an unrelated release branch before main. + if [ ! -z "$api_examples_shengwang_branch" ]; then + branch_name="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $branch_name" >&2 + elif [ ! -z "$GIT_BRANCH" ]; then branch_name="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $branch_name" >&2 elif [ ! -z "$BRANCH_NAME" ]; then @@ -23,16 +42,14 @@ get_branch_name() { else branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$branch_name" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - branch_name=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $branch_name" >&2 + echo "Detached HEAD without explicit branch; skipping branch inference" >&2 + branch_name="" else echo "Branch from git rev-parse: $branch_name" >&2 fi fi - # Remove origin/ prefix if present (but keep the rest of the path) - branch_name=$(echo "$branch_name" | sed 's/^origin\///') + branch_name=$(normalize_branch_name "$branch_name") echo "$branch_name" } @@ -40,11 +57,11 @@ get_branch_name() { # Function: Extract version from branch name # Args: # $1 - Branch name -# Returns: Version string (e.g., "4.6.2") or empty if not in dev/x.x.x format +# Returns: Version string (e.g., "4.6.2") or empty if no version is present extract_branch_version() { local branch_name="$1" - if [[ $branch_name =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + if [[ $branch_name =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then echo "${BASH_REMATCH[1]}" else echo "" @@ -77,13 +94,13 @@ validate_version() { echo "Current branch: $branch_name" - # Extract version from branch name (format: dev/x.x.x) + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) local branch_version=$(extract_branch_version "$branch_name") if [ -z "$branch_version" ]; then - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $branch_name" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" return 1 fi @@ -160,7 +177,7 @@ validate_sdk_version() { local branch_version=$(extract_branch_version "$branch_name") if [ -z "$branch_version" ]; then - echo "Warning: Branch name does not match dev/x.x.x format, skipping SDK version validation" + echo "Warning: Branch name does not contain version number, skipping SDK version validation" echo "Current branch: $branch_name" return 0 fi diff --git a/iOS/APIExample-Audio/cloud_build.sh b/iOS/APIExample-Audio/cloud_build.sh index a04fedb8c..e299ca885 100755 --- a/iOS/APIExample-Audio/cloud_build.sh +++ b/iOS/APIExample-Audio/cloud_build.sh @@ -17,8 +17,13 @@ echo "Starting branch version validation..." # Get current branch name (try multiple methods for CI environments) BRANCH_NAME="" -# Method 1: Try environment variable (Jenkins/GitLab CI) -if [ ! -z "$GIT_BRANCH" ]; then +# Method 1: Try the explicit Jenkins branch parameter first. +# Jenkins checks out a detached HEAD, so inferring from branches containing +# HEAD can pick an unrelated release branch before main. +if [ ! -z "$api_examples_shengwang_branch" ]; then + BRANCH_NAME="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $BRANCH_NAME" +elif [ ! -z "$GIT_BRANCH" ]; then BRANCH_NAME="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $BRANCH_NAME" elif [ ! -z "$BRANCH_NAME" ]; then @@ -30,16 +35,19 @@ elif [ ! -z "$CI_COMMIT_REF_NAME" ]; then elif [ -z "$BRANCH_NAME" ]; then BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$BRANCH_NAME" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - BRANCH_NAME=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $BRANCH_NAME" + echo "Detached HEAD without explicit branch; skipping branch inference" + BRANCH_NAME="" else echo "Branch from git rev-parse: $BRANCH_NAME" fi fi -# Remove origin/ prefix if present (but keep the rest of the path) -BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/^origin\///') +# Remove common git ref prefixes if present (but keep the rest of the path) +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "main" ]; then if [ "$BRANCH_NAME" = "main" ]; then @@ -50,8 +58,8 @@ if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "m else echo "Current branch: $BRANCH_NAME" - # Extract version from branch name (format: dev/x.x.x) - if [[ $BRANCH_NAME =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) + if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then BRANCH_VERSION="${BASH_REMATCH[1]}" echo "Branch version: $BRANCH_VERSION" @@ -83,9 +91,9 @@ else echo "✓ Version validation passed: $BRANCH_VERSION" else - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $BRANCH_NAME" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" exit 1 fi fi @@ -257,5 +265,3 @@ fi echo "==========================================" echo "" - - diff --git a/iOS/APIExample-OC/cloud_build.sh b/iOS/APIExample-OC/cloud_build.sh index ecb5e285c..17bc8a150 100755 --- a/iOS/APIExample-OC/cloud_build.sh +++ b/iOS/APIExample-OC/cloud_build.sh @@ -17,8 +17,13 @@ echo "Starting branch version validation..." # Get current branch name (try multiple methods for CI environments) BRANCH_NAME="" -# Method 1: Try environment variable (Jenkins/GitLab CI) -if [ ! -z "$GIT_BRANCH" ]; then +# Method 1: Try the explicit Jenkins branch parameter first. +# Jenkins checks out a detached HEAD, so inferring from branches containing +# HEAD can pick an unrelated release branch before main. +if [ ! -z "$api_examples_shengwang_branch" ]; then + BRANCH_NAME="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $BRANCH_NAME" +elif [ ! -z "$GIT_BRANCH" ]; then BRANCH_NAME="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $BRANCH_NAME" elif [ ! -z "$BRANCH_NAME" ]; then @@ -30,16 +35,19 @@ elif [ ! -z "$CI_COMMIT_REF_NAME" ]; then elif [ -z "$BRANCH_NAME" ]; then BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$BRANCH_NAME" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - BRANCH_NAME=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $BRANCH_NAME" + echo "Detached HEAD without explicit branch; skipping branch inference" + BRANCH_NAME="" else echo "Branch from git rev-parse: $BRANCH_NAME" fi fi -# Remove origin/ prefix if present (but keep the rest of the path) -BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/^origin\///') +# Remove common git ref prefixes if present (but keep the rest of the path) +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "main" ]; then if [ "$BRANCH_NAME" = "main" ]; then @@ -50,8 +58,8 @@ if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "m else echo "Current branch: $BRANCH_NAME" - # Extract version from branch name (format: dev/x.x.x) - if [[ $BRANCH_NAME =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) + if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then BRANCH_VERSION="${BASH_REMATCH[1]}" echo "Branch version: $BRANCH_VERSION" @@ -83,9 +91,9 @@ else echo "✓ Version validation passed: $BRANCH_VERSION" else - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $BRANCH_NAME" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" exit 1 fi fi @@ -290,5 +298,3 @@ fi echo "==========================================" echo "" - - diff --git a/iOS/APIExample-SwiftUI/cloud_build.sh b/iOS/APIExample-SwiftUI/cloud_build.sh index 4160bf4e2..512ffc11a 100755 --- a/iOS/APIExample-SwiftUI/cloud_build.sh +++ b/iOS/APIExample-SwiftUI/cloud_build.sh @@ -17,8 +17,13 @@ echo "Starting branch version validation..." # Get current branch name (try multiple methods for CI environments) BRANCH_NAME="" -# Method 1: Try environment variable (Jenkins/GitLab CI) -if [ ! -z "$GIT_BRANCH" ]; then +# Method 1: Try the explicit Jenkins branch parameter first. +# Jenkins checks out a detached HEAD, so inferring from branches containing +# HEAD can pick an unrelated release branch before main. +if [ ! -z "$api_examples_shengwang_branch" ]; then + BRANCH_NAME="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $BRANCH_NAME" +elif [ ! -z "$GIT_BRANCH" ]; then BRANCH_NAME="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $BRANCH_NAME" elif [ ! -z "$BRANCH_NAME" ]; then @@ -30,16 +35,19 @@ elif [ ! -z "$CI_COMMIT_REF_NAME" ]; then elif [ -z "$BRANCH_NAME" ]; then BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$BRANCH_NAME" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - BRANCH_NAME=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $BRANCH_NAME" + echo "Detached HEAD without explicit branch; skipping branch inference" + BRANCH_NAME="" else echo "Branch from git rev-parse: $BRANCH_NAME" fi fi -# Remove origin/ prefix if present (but keep the rest of the path) -BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/^origin\///') +# Remove common git ref prefixes if present (but keep the rest of the path) +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "main" ]; then if [ "$BRANCH_NAME" = "main" ]; then @@ -50,8 +58,8 @@ if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "m else echo "Current branch: $BRANCH_NAME" - # Extract version from branch name (format: dev/x.x.x) - if [[ $BRANCH_NAME =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) + if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then BRANCH_VERSION="${BASH_REMATCH[1]}" echo "Branch version: $BRANCH_VERSION" @@ -83,9 +91,9 @@ else echo "✓ Version validation passed: $BRANCH_VERSION" else - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $BRANCH_NAME" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" exit 1 fi fi @@ -269,5 +277,3 @@ fi echo "==========================================" echo "" - - diff --git a/iOS/APIExample/cloud_build.sh b/iOS/APIExample/cloud_build.sh index e2bb82ad6..36f3054cd 100755 --- a/iOS/APIExample/cloud_build.sh +++ b/iOS/APIExample/cloud_build.sh @@ -17,8 +17,13 @@ echo "Starting branch version validation..." # Get current branch name (try multiple methods for CI environments) BRANCH_NAME="" -# Method 1: Try environment variable (Jenkins/GitLab CI) -if [ ! -z "$GIT_BRANCH" ]; then +# Method 1: Try the explicit Jenkins branch parameter first. +# Jenkins checks out a detached HEAD, so inferring from branches containing +# HEAD can pick an unrelated release branch before main. +if [ ! -z "$api_examples_shengwang_branch" ]; then + BRANCH_NAME="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $BRANCH_NAME" +elif [ ! -z "$GIT_BRANCH" ]; then BRANCH_NAME="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $BRANCH_NAME" elif [ ! -z "$BRANCH_NAME" ]; then @@ -30,16 +35,19 @@ elif [ ! -z "$CI_COMMIT_REF_NAME" ]; then elif [ -z "$BRANCH_NAME" ]; then BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$BRANCH_NAME" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - BRANCH_NAME=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $BRANCH_NAME" + echo "Detached HEAD without explicit branch; skipping branch inference" + BRANCH_NAME="" else echo "Branch from git rev-parse: $BRANCH_NAME" fi fi -# Remove origin/ prefix if present (but keep the rest of the path) -BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/^origin\///') +# Remove common git ref prefixes if present (but keep the rest of the path) +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "main" ]; then if [ "$BRANCH_NAME" = "main" ]; then @@ -50,8 +58,8 @@ if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "m else echo "Current branch: $BRANCH_NAME" - # Extract version from branch name (format: dev/x.x.x) - if [[ $BRANCH_NAME =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) + if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then BRANCH_VERSION="${BASH_REMATCH[1]}" echo "Branch version: $BRANCH_VERSION" @@ -84,9 +92,9 @@ else echo "✓ Version validation passed: $BRANCH_VERSION" else - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $BRANCH_NAME" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" exit 1 fi fi @@ -340,5 +348,3 @@ fi echo "==========================================" echo "" - - diff --git a/macOS/cloud_build.sh b/macOS/cloud_build.sh index 56d25f95f..b75d23f02 100755 --- a/macOS/cloud_build.sh +++ b/macOS/cloud_build.sh @@ -17,8 +17,13 @@ echo "Starting branch version validation..." # Get current branch name (try multiple methods for CI environments) BRANCH_NAME="" -# Method 1: Try environment variable (Jenkins/GitLab CI) -if [ ! -z "$GIT_BRANCH" ]; then +# Method 1: Try the explicit Jenkins branch parameter first. +# Jenkins checks out a detached HEAD, so inferring from branches containing +# HEAD can pick an unrelated release branch before main. +if [ ! -z "$api_examples_shengwang_branch" ]; then + BRANCH_NAME="$api_examples_shengwang_branch" + echo "Branch from api_examples_shengwang_branch: $BRANCH_NAME" +elif [ ! -z "$GIT_BRANCH" ]; then BRANCH_NAME="$GIT_BRANCH" echo "Branch from GIT_BRANCH: $BRANCH_NAME" elif [ ! -z "$BRANCH_NAME" ]; then @@ -30,16 +35,19 @@ elif [ ! -z "$CI_COMMIT_REF_NAME" ]; then elif [ -z "$BRANCH_NAME" ]; then BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$BRANCH_NAME" = "HEAD" ]; then - # In detached HEAD state, try to get branch from remote - BRANCH_NAME=$(git branch -r --contains HEAD | grep -v HEAD | head -1 | sed 's/^[[:space:]]*origin\///') - echo "Branch from git branch -r: $BRANCH_NAME" + echo "Detached HEAD without explicit branch; skipping branch inference" + BRANCH_NAME="" else echo "Branch from git rev-parse: $BRANCH_NAME" fi fi -# Remove origin/ prefix if present (but keep the rest of the path) -BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/^origin\///') +# Remove common git ref prefixes if present (but keep the rest of the path) +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed \ + -e 's|^refs/remotes/origin/||' \ + -e 's|^refs/heads/||' \ + -e 's|^remotes/origin/||' \ + -e 's|^origin/||') if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "main" ]; then if [ "$BRANCH_NAME" = "main" ]; then @@ -50,8 +58,8 @@ if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ] || [ "$BRANCH_NAME" = "m else echo "Current branch: $BRANCH_NAME" - # Extract version from branch name (format: dev/x.x.x) - if [[ $BRANCH_NAME =~ ^dev/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) + if [[ $BRANCH_NAME =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then BRANCH_VERSION="${BASH_REMATCH[1]}" echo "Branch version: $BRANCH_VERSION" @@ -84,9 +92,9 @@ else echo "✓ Version validation passed: $BRANCH_VERSION" else - echo "Error: Branch name does not match dev/x.x.x format!" + echo "Error: Branch name does not contain version number!" echo "Current branch: $BRANCH_NAME" - echo "Required format: dev/x.x.x (e.g., dev/4.6.2)" + echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" exit 1 fi fi @@ -242,5 +250,3 @@ fi echo "==========================================" echo "" - - From 56d8c3358993ed5012950f51490fd6545e42759d Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 14:20:09 +0800 Subject: [PATCH 3/6] feat(mac): Add Shengwang product prefix --- .github/ci/build/build_mac.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/ci/build/build_mac.sh b/.github/ci/build/build_mac.sh index 341c61987..59e7ec4de 100644 --- a/.github/ci/build/build_mac.sh +++ b/.github/ci/build/build_mac.sh @@ -103,8 +103,9 @@ python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/APIExample/Po echo "start compress" 7za a -tzip result.zip -r $unzip_name > log.txt echo "start move to" -echo $WORKSPACE/with${BUILD_NUMBER}_$zip_name -mv result.zip $WORKSPACE/with_${BUILD_NUMBER}_$zip_name +sdk_des_path=$WORKSPACE/Shengwang_APIExample_mac_${BUILD_NUMBER}_$zip_name +echo $sdk_des_path +mv result.zip $sdk_des_path if [ $compress_apiexample = true ]; then # Extract SDK version from Podfile (support both commented and uncommented lines) From 6e63924276467d5c52efbe6ae71de4d72056e880 Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 14:29:26 +0800 Subject: [PATCH 4/6] feat(iOS): Add Shengwang product prefix --- .github/ci/build/build_ios.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/ci/build/build_ios.sh b/.github/ci/build/build_ios.sh index 40a21606f..79bf2ea8f 100644 --- a/.github/ci/build/build_ios.sh +++ b/.github/ci/build/build_ios.sh @@ -116,8 +116,9 @@ python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/${ios_directi echo "start compress" 7za a -tzip result.zip -r $unzip_name > log.txt echo "start move to" -echo $WORKSPACE/with${ios_direction}_${BUILD_NUMBER}_$zip_name -mv result.zip $WORKSPACE/with${ios_direction}_${BUILD_NUMBER}_$zip_name +sdk_des_path=$WORKSPACE/Shengwang_APIExample_iOS_${ios_direction}_${BUILD_NUMBER}_$zip_name +echo $sdk_des_path +mv result.zip $sdk_des_path if [ $compress_apiexample = true ]; then # Extract SDK version from Podfile (support both commented and uncommented lines) From bb6b5988119ebbffc0c902f33d9e080d2ac53265 Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 16:08:04 +0800 Subject: [PATCH 5/6] ci: align Shengwang iOS and macOS build artifacts --- .github/ci/build/build_ios.sh | 61 +++--- .github/ci/build/build_mac.sh | 46 +++-- .github/ci/build/common_functions.sh | 258 ++++++++++++++++-------- iOS/APIExample-Audio/cloud_build.sh | 14 +- iOS/APIExample-Audio/cloud_project.sh | 5 - iOS/APIExample-OC/cloud_build.sh | 14 +- iOS/APIExample-OC/cloud_project.sh | 5 - iOS/APIExample-SwiftUI/cloud_build.sh | 14 +- iOS/APIExample-SwiftUI/cloud_project.sh | 5 - iOS/APIExample/cloud_build.sh | 14 +- iOS/APIExample/cloud_project.sh | 5 - macOS/cloud_build.sh | 4 - macOS/cloud_project.sh | 5 - 13 files changed, 265 insertions(+), 185 deletions(-) diff --git a/.github/ci/build/build_ios.sh b/.github/ci/build/build_ios.sh index 79bf2ea8f..5e58d9fe5 100644 --- a/.github/ci/build/build_ios.sh +++ b/.github/ci/build/build_ios.sh @@ -40,18 +40,6 @@ ################################## export PATH=$PATH:/opt/homebrew/bin -echo "==========================================" -echo "=== Git Branch Debug Information ===" -echo "==========================================" -echo "GIT_BRANCH: $GIT_BRANCH" -echo "BRANCH_NAME: $BRANCH_NAME" -echo "CI_COMMIT_REF_NAME: $CI_COMMIT_REF_NAME" -echo "Git branches:" -git branch -a 2>/dev/null || echo "Unable to list git branches" -echo "Current HEAD:" -git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "Unable to get HEAD" -echo "==========================================" - xcode_version=$(xcodebuild -version | grep Xcode | awk '{print $2}') echo "Xcode Version: $xcode_version" echo ios_direction: $ios_direction @@ -78,9 +66,36 @@ unzip_name=Agora_Native_SDK_for_iOS_FULL zip_name=output.zip sdk_url_flag=false apiexample_cn_name=Shengwang_Native_SDK_for_iOS -apiexample_global_name=Agora_Native_SDK_for_iOS cn_dir=CN +# Source common functions +source "$(dirname "$0")/common_functions.sh" + +# Run version validation +run_version_validation "iOS/${ios_direction}" "${ios_direction}" "ios" || exit 1 + +# Validate SDK version in Podfile (skip only for main branch) +if [ "$BRANCH_NAME" != "main" ]; then + if [ -z "$BRANCH_VERSION" ]; then + echo "Error: BRANCH_VERSION is not set, cannot validate SDK version" + exit 1 + fi + + echo "==========================================" + echo "Validating SDK version in Podfile..." + echo "==========================================" + validate_sdk_version "./iOS/${ios_direction}/Podfile" "$BRANCH_VERSION" "ios" || exit 1 + export BRANCH_VERSION + echo "" +fi + +API_EXAMPLES_SDK_VERSION=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'Shengwang(RtcEngine|Audio)_iOS'" "./iOS/${ios_direction}/Podfile" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from ./iOS/${ios_direction}/Podfile" + exit 1 +fi +export API_EXAMPLES_SDK_VERSION + if [ -z "$sdk_url" -o "$sdk_url" = "none" ]; then sdk_url_flag=false echo "sdk_url is empty" @@ -116,25 +131,13 @@ python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/${ios_directi echo "start compress" 7za a -tzip result.zip -r $unzip_name > log.txt echo "start move to" -sdk_des_path=$WORKSPACE/Shengwang_APIExample_iOS_${ios_direction}_${BUILD_NUMBER}_$zip_name +sdk_des_path=$WORKSPACE/Shengwang_with${ios_direction}_${BUILD_NUMBER}_$zip_name echo $sdk_des_path mv result.zip $sdk_des_path if [ $compress_apiexample = true ]; then - # Extract SDK version from Podfile (support both commented and uncommented lines) - # Try ShengwangRtcEngine_iOS first, then ShengwangAudio_iOS - sdk_version=$(grep -E "Shengwang(RtcEngine|Audio)_iOS" ./iOS/${ios_direction}/Podfile | sed -n "s/.*'\([0-9.]*\)'.*/\1/p" | head -1) - echo "sdk_version: $sdk_version" - - # Source common functions for version validation - source ./.github/ci/build/common_functions.sh - - # Validate SDK version against branch version - validate_sdk_version "$sdk_version" || exit 1 - - # Validate project version against branch version - validate_version "./iOS/${ios_direction}/${ios_direction}.xcodeproj/project.pbxproj" "" "ios" || exit 1 - + echo "Using version for package: $API_EXAMPLES_SDK_VERSION" + mkdir -p $cn_dir cp -rf ./iOS/${ios_direction} $cn_dir/ cd $cn_dir/${ios_direction} @@ -145,7 +148,7 @@ if [ $compress_apiexample = true ]; then echo "complete compress api example" echo "current path: `pwd`" ls -al - cn_des_path=$WORKSPACE/${apiexample_cn_name}_v${sdk_version}_APIExample_${BUILD_NUMBER}.zip + cn_des_path=$WORKSPACE/${apiexample_cn_name}_v${API_EXAMPLES_SDK_VERSION}_APIExample_${BUILD_NUMBER}.zip echo "cn_des_path: $cn_des_path" echo "Moving cn_result.zip to $cn_des_path" mv cn_result.zip $cn_des_path diff --git a/.github/ci/build/build_mac.sh b/.github/ci/build/build_mac.sh index 59e7ec4de..458df1a40 100644 --- a/.github/ci/build/build_mac.sh +++ b/.github/ci/build/build_mac.sh @@ -67,6 +67,34 @@ apiexample_global_name=Agora_Native_SDK_for_Mac cn_dir=CN global_dir=Global +# Source common functions +source "$(dirname "$0")/common_functions.sh" + +# Run version validation +run_version_validation "macOS" "APIExample" "macos" || exit 1 + +# Validate SDK version in Podfile (skip only for main branch) +if [ "$BRANCH_NAME" != "main" ]; then + if [ -z "$BRANCH_VERSION" ]; then + echo "Error: BRANCH_VERSION is not set, cannot validate SDK version" + exit 1 + fi + + echo "==========================================" + echo "Validating SDK version in Podfile..." + echo "==========================================" + validate_sdk_version "./macOS/Podfile" "$BRANCH_VERSION" "macos" || exit 1 + export BRANCH_VERSION + echo "" +fi + +API_EXAMPLES_SDK_VERSION=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'ShengwangRtcEngine_macOS'" "./macOS/Podfile" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from ./macOS/Podfile" + exit 1 +fi +export API_EXAMPLES_SDK_VERSION + echo zip_name: $zip_name if [ -z "$sdk_url" -o "$sdk_url" = "none" ]; then sdk_url_flag=false @@ -108,20 +136,8 @@ echo $sdk_des_path mv result.zip $sdk_des_path if [ $compress_apiexample = true ]; then - # Extract SDK version from Podfile (support both commented and uncommented lines) - # Try ShengwangRtcEngine_macOS first, then ShengwangAudio_macOS - sdk_version=$(grep -E "Shengwang(RtcEngine|Audio)_macOS" ./macOS/Podfile | sed -n "s/.*'\([0-9.]*\)'.*/\1/p" | head -1) - echo "sdk_version: $sdk_version" - - # Source common functions for version validation - source ./.github/ci/build/common_functions.sh - - # Validate SDK version against branch version - validate_sdk_version "$sdk_version" || exit 1 - - # Validate project version against branch version - validate_version "./macOS/APIExample.xcodeproj/project.pbxproj" "" "macos" || exit 1 - + echo "Using version for package: $API_EXAMPLES_SDK_VERSION" + mkdir -p $cn_dir echo "cn_dir: $cn_dir" cp -rf ./macOS $cn_dir/ @@ -135,7 +151,7 @@ if [ $compress_apiexample = true ]; then echo "complete compress api example" echo "current path: `pwd`" ls -al - cn_des_path=$WORKSPACE/${apiexample_cn_name}_v${sdk_version}_APIExample_${BUILD_NUMBER}.zip + cn_des_path=$WORKSPACE/${apiexample_cn_name}_v${API_EXAMPLES_SDK_VERSION}_APIExample_${BUILD_NUMBER}.zip echo "cn_des_path: $cn_des_path" echo "Moving cn_result.zip to $cn_des_path" mv cn_result.zip $cn_des_path diff --git a/.github/ci/build/common_functions.sh b/.github/ci/build/common_functions.sh index 55fd6774a..739a4e12e 100755 --- a/.github/ci/build/common_functions.sh +++ b/.github/ci/build/common_functions.sh @@ -68,133 +68,215 @@ extract_branch_version() { fi } -# Function: Validate version between branch name and project file +# Function: Extract MARKETING_VERSION from a project.pbxproj file # Args: # $1 - Path to project.pbxproj file -# $2 - Branch name (optional, will auto-detect if not provided) -# $3 - Platform (optional: "ios" or "macos", defaults to "ios") -# Returns: 0 on success, 1 on failure -validate_version() { +# $2 - Platform (optional: "ios" or "macos", defaults to "ios") +# Returns: Version string or empty +extract_project_marketing_version() { local pbxproj_file="$1" - local branch_name="${2:-$(get_branch_name)}" - local platform="${3:-ios}" - - echo "Starting branch version validation..." - - if [ -z "$branch_name" ] || [ "$branch_name" = "HEAD" ]; then - echo "Warning: Unable to get Git branch name, skipping version validation" - return 0 + local platform="${2:-ios}" + local plist_version="" + + if [ "$platform" = "macos" ]; then + plist_version=$(grep -A 2 "@executable_path/../Frameworks" "$pbxproj_file" | grep "MARKETING_VERSION" | head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/' | tr -d ' ') + else + plist_version=$(grep -A 2 "@executable_path/Frameworks" "$pbxproj_file" | grep "MARKETING_VERSION" | head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/' | tr -d ' ') fi - # Skip version check for main branch (we trust main when building from it) - if [ "$branch_name" = "main" ]; then - echo "Branch is main, skipping version validation (main branch is trusted)" - return 0 + if [ -z "$plist_version" ]; then + plist_version=$(grep "MARKETING_VERSION" "$pbxproj_file" | grep -v "//" | head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/' | tr -d ' ') fi - echo "Current branch: $branch_name" + echo "$plist_version" +} + +# Function: Extract SDK version from a Podfile +# Args: +# $1 - Podfile path +# $2 - SDK type (optional: "ios" or "macos", defaults to "ios") +# Returns: Version string or empty +extract_podfile_sdk_version() { + local podfile_path="$1" + local sdk_type="${2:-ios}" + local sdk_version="" - # Extract version from branch name (for example: dev/x.x.x or release/x.x.x) - local branch_version=$(extract_branch_version "$branch_name") - - if [ -z "$branch_version" ]; then - echo "Error: Branch name does not contain version number!" - echo "Current branch: $branch_name" - echo "Branch name must contain x.x.x (e.g., dev/4.6.2, release/4.6.2)" - return 1 + if [ "$sdk_type" = "macos" ]; then + sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'ShengwangRtcEngine_macOS'" "$podfile_path" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) + else + sdk_version=$(grep -E "^[[:space:]]*#?[[:space:]]*pod[[:space:]]+'Shengwang(RtcEngine|Audio)_iOS'" "$podfile_path" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) fi - - echo "Branch version: $branch_version" - - # Check if project.pbxproj file exists + + echo "$sdk_version" +} + +# Function: Validate project MARKETING_VERSION against branch version +# Args: +# $1 - Project path (e.g., "iOS/APIExample" or "macOS") +# $2 - Project name (e.g., "APIExample") +# $3 - Branch version (e.g., "4.6.2") +# $4 - Platform (optional: "ios" or "macos", defaults to "ios") +# Returns: 0 on success, 1 on failure +validate_project_version() { + local project_path="$1" + local project_name="$2" + local branch_version="$3" + local platform="${4:-ios}" + + echo "-----------------------------------" + echo "Validating project version: $project_path" + + local pbxproj_file="${project_path}/${project_name}.xcodeproj/project.pbxproj" + if [ ! -f "$pbxproj_file" ]; then echo "Error: project.pbxproj file not found: $pbxproj_file" return 1 fi - - # Extract MARKETING_VERSION for main target (skip Extension targets) - # iOS uses @executable_path/Frameworks, macOS uses @executable_path/../Frameworks - local plist_version="" - if [ "$platform" = "macos" ]; then - plist_version=$(grep -A 2 "@executable_path/../Frameworks" "$pbxproj_file" | grep "MARKETING_VERSION" | head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/' | tr -d ' ') - else - plist_version=$(grep -A 2 "@executable_path/Frameworks" "$pbxproj_file" | grep "MARKETING_VERSION" | head -1 | sed 's/.*MARKETING_VERSION = \([^;]*\);/\1/' | tr -d ' ') - fi - + + local plist_version=$(extract_project_marketing_version "$pbxproj_file" "$platform") + if [ -z "$plist_version" ]; then echo "Error: Unable to read MARKETING_VERSION from project.pbxproj" return 1 fi - - echo "Info.plist version: $plist_version" - - # Compare versions + + echo "Project version: $plist_version" + if [ "$branch_version" != "$plist_version" ]; then + echo "" + echo "==========================================" echo "Error: Version mismatch!" - echo " Branch version: $branch_version" - echo " Info.plist version: $plist_version" + echo "==========================================" + echo " Branch version: $branch_version" + echo " Project version: $plist_version" + echo " Project path: $project_path" + echo "" echo "Please ensure the version in branch name matches MARKETING_VERSION in Info.plist" + echo "" return 1 fi - - echo "✓ Version validation passed: $branch_version" - echo "Version validation completed" - echo "-----------------------------------" + + echo "✓ Project version matches: $plist_version" return 0 } -# Function: Validate SDK version against branch version +# Function: Validate SDK version in Podfile against branch version # Args: -# $1 - SDK version (e.g., "4.6.2") -# $2 - Branch name (optional, will auto-detect if not provided) +# $1 - Podfile path +# $2 - Branch version +# $3 - SDK type (optional: "ios" or "macos", defaults to "ios") # Returns: 0 on success, 1 on failure validate_sdk_version() { - local sdk_version="$1" - local branch_name="${2:-$(get_branch_name)}" - - echo "Starting SDK version validation..." - + local podfile_path="$1" + local branch_version="$2" + local sdk_type="${3:-ios}" + + echo "-----------------------------------" + echo "Validating SDK version: $podfile_path" + + if [ -z "$branch_version" ]; then + echo "Error: Branch version is empty, cannot validate SDK version" + return 1 + fi + + if [ ! -f "$podfile_path" ]; then + echo "Error: Podfile not found: $podfile_path" + return 1 + fi + + local sdk_version=$(extract_podfile_sdk_version "$podfile_path" "$sdk_type") + if [ -z "$sdk_version" ]; then - echo "Warning: SDK version is empty, skipping SDK version validation" - return 0 + echo "Error: Unable to extract SDK version from Podfile" + echo "Podfile path: $podfile_path" + return 1 fi - - if [ -z "$branch_name" ] || [ "$branch_name" = "HEAD" ]; then - echo "Warning: Unable to get Git branch name, skipping SDK version validation" - return 0 + + echo "SDK version: $sdk_version" + + if [ "$branch_version" != "$sdk_version" ]; then + echo "" + echo "==========================================" + echo "Error: SDK version mismatch!" + echo "==========================================" + echo " Branch version: $branch_version" + echo " SDK version: $sdk_version" + echo " Podfile path: $podfile_path" + echo "" + echo "Please ensure the SDK version in Podfile matches the branch version." + echo "" + return 1 fi - # Skip version check for main branch (we trust main when building from it) - if [ "$branch_name" = "main" ]; then - echo "Branch is main, skipping SDK version validation (main branch is trusted)" - return 0 + echo "✓ SDK version matches: $sdk_version" + return 0 +} + +# Function: Main version validation entry point +# Args: +# $1 - Project path +# $2 - Project name +# $3 - Platform ("ios" or "macos") +# Returns: 0 on success, 1 on failure +# Sets global variables: BRANCH_NAME, BRANCH_VERSION +run_version_validation() { + local project_path="$1" + local project_name="$2" + local platform="$3" + + echo "==========================================" + echo "Starting branch version validation..." + echo "==========================================" + + BRANCH_NAME=$(get_branch_name) + + if [ -z "$BRANCH_NAME" ] || [ "$BRANCH_NAME" = "HEAD" ]; then + echo "Error: Unable to get Git branch name" + echo "Please ensure you are on a valid branch" + return 1 fi - echo "Current branch: $branch_name" - echo "SDK version from Podfile: $sdk_version" + echo "Current branch: $BRANCH_NAME" - # Extract version from branch name - local branch_version=$(extract_branch_version "$branch_name") - - if [ -z "$branch_version" ]; then - echo "Warning: Branch name does not contain version number, skipping SDK version validation" - echo "Current branch: $branch_name" + if [ "$BRANCH_NAME" = "main" ]; then + echo "Branch is 'main', skipping version validation (main branch is trusted)" + BRANCH_VERSION="" + echo "Version validation completed" + echo "==========================================" + echo "" return 0 fi - - echo "Branch version: $branch_version" - - # Compare SDK version with branch version - if [ "$sdk_version" != "$branch_version" ]; then - echo "Error: SDK version mismatch!" - echo " SDK version (Podfile): $sdk_version" - echo " Branch version: $branch_version" - echo "Please ensure the SDK version in Podfile matches the branch version" + + BRANCH_VERSION=$(extract_branch_version "$BRANCH_NAME") + + if [ -z "$BRANCH_VERSION" ]; then + echo "" + echo "==========================================" + echo "Error: Branch naming is not compliant!" + echo "==========================================" + echo "Current branch: $BRANCH_NAME" + echo "Branch name must contain version number (e.g., dev/4.6.2, release/4.6.2)" + echo "" + echo "Branch naming rules:" + echo " - Version branches must contain x.x.x" + echo " - Main branch: main (skips validation)" + echo "" return 1 fi - - echo "✓ SDK version validation passed: $sdk_version" - echo "SDK version validation completed" + + echo "Branch version: $BRANCH_VERSION" + echo "Current building project: $project_path" + echo "" + + if ! validate_project_version "$project_path" "$project_name" "$BRANCH_VERSION" "$platform"; then + return 1 + fi + echo "-----------------------------------" + echo "✓ All version validations passed: $BRANCH_VERSION" + echo "Version validation completed" + echo "==========================================" + echo "" + return 0 } diff --git a/iOS/APIExample-Audio/cloud_build.sh b/iOS/APIExample-Audio/cloud_build.sh index e299ca885..529aa1913 100755 --- a/iOS/APIExample-Audio/cloud_build.sh +++ b/iOS/APIExample-Audio/cloud_build.sh @@ -7,10 +7,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - # Version validation logic echo "Starting branch version validation..." @@ -204,8 +200,14 @@ xcodebuild -exportArchive \ -allowProvisioningUpdates || exit 1 # 重命名并移动 IPA 文件 -SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) -OUTPUT_FILE=${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + API_EXAMPLES_SDK_VERSION=$(grep -E "pod 'Shengwang(RtcEngine|Audio)_iOS'" Podfile | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +fi +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from Podfile" + exit 1 +fi +OUTPUT_FILE=${WORKSPACE}/Shengwang_${TARGET_NAME}_${BUILD_NUMBER}_${API_EXAMPLES_SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa mv ${EXPORT_PATH}/${TARGET_NAME}.ipa $OUTPUT_FILE # 清理临时文件 diff --git a/iOS/APIExample-Audio/cloud_project.sh b/iOS/APIExample-Audio/cloud_project.sh index 3617dd1a1..e3d349cdd 100755 --- a/iOS/APIExample-Audio/cloud_project.sh +++ b/iOS/APIExample-Audio/cloud_project.sh @@ -5,9 +5,4 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - cd ${PROJECT_PATH} && pod install || exit 1 - diff --git a/iOS/APIExample-OC/cloud_build.sh b/iOS/APIExample-OC/cloud_build.sh index 17bc8a150..361bd1b1a 100755 --- a/iOS/APIExample-OC/cloud_build.sh +++ b/iOS/APIExample-OC/cloud_build.sh @@ -7,10 +7,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - # Version validation logic echo "Starting branch version validation..." @@ -237,8 +233,14 @@ xcodebuild -exportArchive \ -allowProvisioningUpdates || exit 1 # 重命名并移动 IPA 文件 -SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) -OUTPUT_FILE=${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + API_EXAMPLES_SDK_VERSION=$(grep -E "pod 'Shengwang(RtcEngine|Audio)_iOS'" Podfile | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +fi +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from Podfile" + exit 1 +fi +OUTPUT_FILE=${WORKSPACE}/Shengwang_${TARGET_NAME}_${BUILD_NUMBER}_${API_EXAMPLES_SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa mv ${EXPORT_PATH}/${TARGET_NAME}.ipa $OUTPUT_FILE # 清理临时文件 diff --git a/iOS/APIExample-OC/cloud_project.sh b/iOS/APIExample-OC/cloud_project.sh index 3617dd1a1..e3d349cdd 100755 --- a/iOS/APIExample-OC/cloud_project.sh +++ b/iOS/APIExample-OC/cloud_project.sh @@ -5,9 +5,4 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - cd ${PROJECT_PATH} && pod install || exit 1 - diff --git a/iOS/APIExample-SwiftUI/cloud_build.sh b/iOS/APIExample-SwiftUI/cloud_build.sh index 512ffc11a..5a4783a82 100755 --- a/iOS/APIExample-SwiftUI/cloud_build.sh +++ b/iOS/APIExample-SwiftUI/cloud_build.sh @@ -7,10 +7,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - # Version validation logic echo "Starting branch version validation..." @@ -216,8 +212,14 @@ xcodebuild -exportArchive \ -allowProvisioningUpdates || exit 1 # 重命名并移动 IPA 文件 -SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) -OUTPUT_FILE=${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + API_EXAMPLES_SDK_VERSION=$(grep -E "pod 'Shengwang(RtcEngine|Audio)_iOS'" Podfile | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +fi +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from Podfile" + exit 1 +fi +OUTPUT_FILE=${WORKSPACE}/Shengwang_${TARGET_NAME}_${BUILD_NUMBER}_${API_EXAMPLES_SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa mv ${EXPORT_PATH}/${TARGET_NAME}.ipa $OUTPUT_FILE # 清理临时文件 diff --git a/iOS/APIExample-SwiftUI/cloud_project.sh b/iOS/APIExample-SwiftUI/cloud_project.sh index 3617dd1a1..e3d349cdd 100755 --- a/iOS/APIExample-SwiftUI/cloud_project.sh +++ b/iOS/APIExample-SwiftUI/cloud_project.sh @@ -5,9 +5,4 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - cd ${PROJECT_PATH} && pod install || exit 1 - diff --git a/iOS/APIExample/cloud_build.sh b/iOS/APIExample/cloud_build.sh index 36f3054cd..03e09a8db 100755 --- a/iOS/APIExample/cloud_build.sh +++ b/iOS/APIExample/cloud_build.sh @@ -7,10 +7,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - # Version validation logic echo "Starting branch version validation..." @@ -287,8 +283,14 @@ xcodebuild -exportArchive \ -allowProvisioningUpdates || exit 1 # 重命名并移动 IPA 文件 -SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5) -OUTPUT_FILE=${WORKSPACE}/${TARGET_NAME}_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + API_EXAMPLES_SDK_VERSION=$(grep -E "pod 'Shengwang(RtcEngine|Audio)_iOS'" Podfile | grep -oE "[0-9]+\.[0-9]+\.[0-9]+" | head -n 1) +fi +if [ -z "$API_EXAMPLES_SDK_VERSION" ]; then + echo "Error: Unable to determine SDK version from Podfile" + exit 1 +fi +OUTPUT_FILE=${WORKSPACE}/Shengwang_${TARGET_NAME}_${BUILD_NUMBER}_${API_EXAMPLES_SDK_VERSION}_$(date "+%Y%m%d%H%M%S").ipa mv ${EXPORT_PATH}/${TARGET_NAME}.ipa $OUTPUT_FILE # 清理临时文件 diff --git a/iOS/APIExample/cloud_project.sh b/iOS/APIExample/cloud_project.sh index 5a666e417..0cd90e730 100755 --- a/iOS/APIExample/cloud_project.sh +++ b/iOS/APIExample/cloud_project.sh @@ -5,10 +5,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - #下载美颜资源 echo "start download bytedance resource : $bytedance_lib" curl -L -O "$bytedance_lib" @@ -34,4 +30,3 @@ perl -i -pe "s#\#pod 'bytedEffect'#pod 'bytedEffect'#g" Podfile perl -i -pe "s#\#pod 'fuLib'#pod 'fuLib'#g" Podfile pod install --repo-update || exit 1 - diff --git a/macOS/cloud_build.sh b/macOS/cloud_build.sh index b75d23f02..13cc341a2 100755 --- a/macOS/cloud_build.sh +++ b/macOS/cloud_build.sh @@ -7,10 +7,6 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - # Version validation logic echo "Starting branch version validation..." diff --git a/macOS/cloud_project.sh b/macOS/cloud_project.sh index 8b42c6d71..9728c91a2 100755 --- a/macOS/cloud_project.sh +++ b/macOS/cloud_project.sh @@ -5,9 +5,4 @@ PROJECT_PATH=$PWD if [ "$WORKSPACE" = "" ]; then WORKSPACE=$PWD fi -if [ "$BUILD_NUMBER" = "" ]; then - BUILD_NUMBER=888 -fi - cd "${PROJECT_PATH}" && pod install || exit 1 - From 84dc5f6564d222bd0fc6be5780a22b150623e6de Mon Sep 17 00:00:00 2001 From: zhangwei Date: Wed, 3 Jun 2026 17:35:42 +0800 Subject: [PATCH 6/6] fix(iOS): align legacy IPA signing profile --- .github/ci/build/build_ios_ipa.sh | 37 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/ci/build/build_ios_ipa.sh b/.github/ci/build/build_ios_ipa.sh index e63a4f94f..4c1572684 100755 --- a/.github/ci/build/build_ios_ipa.sh +++ b/.github/ci/build/build_ios_ipa.sh @@ -38,22 +38,22 @@ echo PBXPROJ_PATH: $PBXPROJ_PATH if [ $IS_OBJECTIVE_C = true ]; then # Debug /usr/libexec/PlistBuddy -c "Set :objects:E70ADE062A5D0050009947CF:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E70ADE062A5D0050009947CF:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E70ADE062A5D0050009947CF:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E70ADE062A5D0050009947CF:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E70ADE062A5D0050009947CF:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # Release /usr/libexec/PlistBuddy -c "Set :objects:E70ADE072A5D0050009947CF:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E70ADE072A5D0050009947CF:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E70ADE072A5D0050009947CF:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E70ADE072A5D0050009947CF:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E70ADE072A5D0050009947CF:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # 屏幕共享Extension # Debug - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D42A7256D500C963D2:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D42A7256D500C963D2:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D42A7256D500C963D2:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623E2A7B8AFB00C963D2:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623E2A7B8AFB00C963D2:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623E2A7B8AFB00C963D2:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # Release - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D52A7256D500C963D2:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D52A7256D500C963D2:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:E72F61D52A7256D500C963D2:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623F2A7B8AFB00C963D2:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623F2A7B8AFB00C963D2:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:E72F623F2A7B8AFB00C963D2:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # SimpleFilter # Debug @@ -73,22 +73,22 @@ if [ $IS_OBJECTIVE_C = true ]; then else # Debug /usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:03D13BF72448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # Release /usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:03D13BF82448758C00B599B3:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # 屏幕共享Extension # Debug /usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:0339BEB825205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # Release /usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:CODE_SIGN_STYLE 'Manual'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'GM72UGLGZW'" $PBXPROJ_PATH - /usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'App'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:DEVELOPMENT_TEAM 'YS397FG5PA'" $PBXPROJ_PATH + /usr/libexec/PlistBuddy -c "Set :objects:0339BEB925205B80007D4FDD:buildSettings:PROVISIONING_PROFILE_SPECIFIER 'apiexample_wildcard_adhoc'" $PBXPROJ_PATH # SimpleFilter # Debug @@ -166,4 +166,3 @@ python3 /tmp/jenkins/api-examples/.github/ci/build/modify_ios_keycenter.py $KEYC -