Generate xcarchive into a specific folder from the command line

后端 未结 7 767
南旧
南旧 2020-11-28 23:58

For the purposes of CI, I need to be able to generate an XCARCHIVE and an IPA file in our nightly build. The IPA is for our testers, to be signed with our ad-hoc keys, and t

相关标签:
7条回答
  • 2020-11-29 00:37

    Starting with Xcode 4 Preview 5 there are three environment variables that are accessible in the scheme archive's post-actions.

    ARCHIVE_PATH: The path to the archive.
    ARCHIVE_PRODUCTS_PATH: The installation location for the archived product.
    ARCHIVE_DSYMS_PATH: The path to the product’s dSYM files.
    

    You could move/copy the archive in here. I wanted to have a little more control over the process in a CI script, so I saved a temporary file that could easily be sourced in my CI script that contained these values.

    BUILD_DIR=$PROJECT_DIR/build
    echo "ARCHIVE_PATH=\"$ARCHIVE_PATH\"" > $BUILD_DIR/archive_paths.sh
    echo "ARCHIVE_PRODUCTS_PATH=\"$ARCHIVE_PRODUCTS_PATH\"" >> $BUILD_DIR/archive_paths.sh
    echo "ARCHIVE_DSYMS_PATH=\"$ARCHIVE_DSYMS_PATH\"" >> $BUILD_DIR/archive_paths.sh
    echo "INFOPLIST_PATH=\"$INFOPLIST_PATH\"" >> $BUILD_DIR/archive_paths.sh
    

    Then in my CI script I can run the following:

    xcodebuild -alltargets -scheme [Scheme Name] -configuration [Config Name] clean archive
    source build/archive_paths.sh
    ARCHIVE_NAME=AppName-$APP_VERSION-$APP_BUILD.xcarchive
    cp -r "$ARCHIVE_PATH" "$BUILD_DIR/$ARCHIVE_NAME"
    
    0 讨论(0)
提交回复
热议问题