66 - ' Release-*' # Trigger for branches starting with "Release-"
77
88jobs :
9- BuildAndTestAppOnGPTDriver :
10- runs-on : macos-latest
9+ BuildAndTestAppOnGPTDriver : # Updated job name
10+ runs-on : macos-latest # macOS runner is required for iOS builds
1111 steps :
1212 # --- Step 1: Extract version from branch name ---
1313 - name : Extract version from branch name
1414 id : extract_version_step
1515 run : |
1616 BRANCH_NAME="${{ github.ref }}"
17+ # Remove 'refs/heads/' prefix (e.g., refs/heads/Release-0.0.0 -> Release-0.0.0)
1718 BRANCH_NAME_WITHOUT_PREFIX="${BRANCH_NAME#refs/heads/}"
19+ # Extract version after "Release-" (e.g., Release-0.0.0 -> 0.0.0)
1820 VERSION=$(echo "$BRANCH_NAME_WITHOUT_PREFIX" | sed -n 's/^Release-\([0-9]*\.[0-9]*\.[0-9]*\)$/\1/p')
1921
2022 if [ -z "$VERSION" ]; then
@@ -25,10 +27,16 @@ jobs:
2527 echo "Extracted versionName: $VERSION"
2628 echo "VERSION_STRING=$VERSION" >> $GITHUB_ENV
2729
30+ # Convert semantic version to an integer for CFBundleVersion (versionCode equivalent)
31+ # Example: 1.2.3 -> 102003 (assuming max 2 digits for minor/patch)
32+ # This should be adjusted based on the maximum expected values for major/minor/patch
2833 MAJOR=$(echo "$VERSION" | cut -d. -f1)
2934 MINOR=$(echo "$VERSION" | cut -d. -f2)
3035 PATCH=$(echo "$VERSION" | cut -d. -f3)
3136
37+ # Calculate versionCode (CFBundleVersion) - ensure this fits in a 32-bit integer
38+ # Standard Android-like conversion: Major * 10000 + Minor * 100 + Patch
39+ # This provides sufficient uniqueness for most common versioning schemes.
3240 VERSION_CODE_INT=$(( MAJOR * 10000 + MINOR * 100 + PATCH ))
3341 echo "Calculated versionCode: $VERSION_CODE_INT"
3442 echo "VERSION_CODE_INT=$VERSION_CODE_INT" >> $GITHUB_ENV
@@ -39,14 +47,14 @@ jobs:
3947 uses : actions/checkout@v4
4048 with :
4149 repository : BranchMetrics/ios-branch-deep-linking-attribution
42- ref : ${{ github.ref }}
43- path : ./branch-ios-sdk-repo
50+ ref : ${{ github.ref }} # Use the same branch that triggered the workflow
51+ path : ./branch-ios-sdk-repo # Checkout into a subdirectory
4452
4553 # --- Step 3: Build the iOS Branch SDK Framework ---
4654 - name : Build Branch SDK Framework
4755 run : |
4856 echo "--- Listing contents of the SDK repo directory for debugging ---"
49- ls -R .
57+ ls -R . # List contents recursively from the current working directory
5058 echo "-------------------------------------------------------------"
5159 echo "Attempting to build the SDK framework..."
5260 xcodebuild build -project BranchSDK.xcodeproj \
@@ -55,22 +63,24 @@ jobs:
5563 -sdk iphonesimulator \
5664 BUILD_DIR="${{ github.workspace }}/branch-ios-sdk-repo/build" \
5765 SKIP_INSTALL=NO
58- working-directory : ./branch-ios-sdk-repo
66+ working-directory : ./branch-ios-sdk-repo # Run xcodebuild from the SDK's checkout directory
5967
6068 # --- Step 4: Checkout the iOS Branch Link Simulator App repository ---
6169 - name : Checkout BranchMetrics/BranchLinkSimulator (App)
6270 uses : actions/checkout@v4
6371 with :
6472 repository : BranchMetrics/BranchLinkSimulator
65- ref : gptdriver/linkingTests
66- path : ./ios-app-repo
73+ ref : gptdriver/linkingTests # Checkout the specific app branch
74+ path : ./ios-app-repo # Checkout into another subdirectory
6775
6876 # --- Step 5: Copy the generated SDK Framework to the App's project ---
6977 - name : Copy generated SDK Framework to App's project
7078 run : |
79+ # Create a 'Frameworks' directory within the app repo for the local SDK
7180 mkdir -p ./ios-app-repo/Frameworks
81+ # Copy the built framework
7282 cp -R ./branch-ios-sdk-repo/build/Debug-iphonesimulator/BranchSDK.framework ./ios-app-repo/Frameworks/
73- working-directory : ${{ github.workspace }}
83+ working-directory : ${{ github.workspace }} # Run from the root of the GITHUB_WORKSPACE
7484
7585 # --- Step 6: Archive iOS App (to prepare for IPA export) ---
7686 - name : Archive iOS App
@@ -112,7 +122,7 @@ jobs:
112122
113123 # Create a simple ExportOptions.plist for 'development' method (suitable for debug/test IPAs)
114124 EXPORT_OPTIONS_PLIST_PATH="$IPA_OUTPUT_DIR/ExportOptions.plist"
115- cat <<EOF > "$EXPORT_OPTIONS_PLIST_PATH"
125+ cat <<EOF_PLIST > "$EXPORT_OPTIONS_PLIST_PATH" # Changed EOF to EOF_PLIST
116126<?xml version="1.0" encoding="UTF-8"?>
117127<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
118128<plist version="1.0">
@@ -125,7 +135,7 @@ jobs:
125135 <false/>
126136</dict>
127137</plist>
128- EOF
138+ EOF_PLIST # Ensure this matches the opening EOF_PLIST and is at the same indentation as 'cat <<EOF_PLIST'
129139 echo "Exporting IPA to : $IPA_OUTPUT_DIR"
130140 xcodebuild -exportArchive \
131141 -archivePath "${{ env.ARCHIVE_PATH }}" \
136146 # Find the generated IPA file dynamically, as its exact name might vary
137147 GENERATED_IPA=$(find "$IPA_OUTPUT_DIR" -name "*.ipa" -print -quit)
138148 if [ -z "$GENERATED_IPA" ]; then
139- echo "Error : Could not find generated IPA file in $IPA_OUTPUT_DIR ."
149+ echo "Error : Could not find generated IPA file."
140150 exit 1
141151 fi
142152
0 commit comments