vibhor110203
vibhor110203

Reputation: 1

Archive not building for xcframework on xcode cloud workflow

The first archive for simulator gets build but does not for the ios one. Gives this error again and again :

Showing All Messages
/Volumes/workspace/repository/cicd-testing-framework.xcodeproj: error:
No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "567*****" with a private key was found. (in target 'cicd-testing-framework' from project 'cicd-testing-framework')

This is my post_clone.sh script:

#!/bin/bash

chmod +x ci_post_clone.sh

set -x

# Ensure we are in the temp directory for script execution
cd "$TMPDIR" || exit 1

# Variables
CI_REPOSITORY_PATH="/Volumes/workspace/repository"
CI_PRODUCT="cicd-testing-framework"
CI_CONFIGURATION="Release"
CI_XCODE_PROJECT="cicd-testing-framework.xcodeproj"  # Project name only
CI_XCODE_SCHEME="cicd-testing-framework"  # Scheme name

BUILD_DIR="$TMPDIR/build"  # Build in TMPDIR
mkdir -p "$BUILD_DIR"

ARCHIVE_DIR="$BUILD_DIR/archive"
mkdir -p "$ARCHIVE_DIR"

ARCHIVE_SIMULATOR_PATH="$ARCHIVE_DIR/${CI_PRODUCT}-iphonesimulator.xcarchive"
ARCHIVE_IOS_PATH="$ARCHIVE_DIR/${CI_PRODUCT}-iphoneos.xcarchive"

FRAMEWORK_SIMULATOR_PATH="$ARCHIVE_SIMULATOR_PATH/Products/Library/Frameworks/${CI_PRODUCT}.framework"
FRAMEWORK_IOS_PATH="$ARCHIVE_IOS_PATH/Products/Library/Frameworks/${CI_PRODUCT}.framework"

# Temporarily switch to the repository directory for Xcode commands
pushd "$CI_REPOSITORY_PATH" || exit 1

echo "Current directory : $(pwd)"

# Build for simulator
xcodebuild archive \
  -project "$CI_XCODE_PROJECT" \
  -scheme "$CI_XCODE_SCHEME" \
  -configuration "$CI_CONFIGURATION" \
  -archivePath "$ARCHIVE_SIMULATOR_PATH" \
  -sdk iphonesimulator \
  SKIP_INSTALL=NO \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES
  
  echo "Build for simulator succeeded"
  echo "still in $(pwd)"

# Build for iOS
xcodebuild archive \
  -project "$CI_XCODE_PROJECT" \
  -scheme "$CI_XCODE_SCHEME" \
  -configuration "$CI_CONFIGURATION" \
  -archivePath "$ARCHIVE_IOS_PATH" \
  -sdk iphoneos \
  SKIP_INSTALL=NO \
  BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# Return to the temp directory
popd

# Create XCFramework if both simulator and iOS builds are successful
if [ -d "$FRAMEWORK_SIMULATOR_PATH" ] && [ -d "$FRAMEWORK_IOS_PATH" ]; then
  xcodebuild -create-xcframework \
    -framework "$FRAMEWORK_SIMULATOR_PATH" \
    -framework "$FRAMEWORK_IOS_PATH" \
    -output "$BUILD_DIR/${CI_PRODUCT}.xcframework"
  echo "Created XCFramework at $BUILD_DIR/${CI_PRODUCT}.xcframework"
else
  echo "Error: One or both framework paths do not exist."
  exit 1
fi

echo "XCFramework creation completed successfully."

I have tried running this in local and giving absolute project name in the xcode build command for ios, it ran there, but here in the script it shows project not found.

Upvotes: 0

Views: 54

Answers (0)

Related Questions