• [iOS开发] 使用Jenkins自动打包并上传至蒲公英


    设置构建触发器

    Poll SCM

    H/2 * * * *

    设置 构建脚本

    #
    #xodebuild & jenkins 自动构建并上传至pgyer.com
    #2017年5月9日
    #
    
    #定义一些变量
    PROJ_NAME="zhixinStuApp"
    cd ./${PROJ_NAME}
    ARCHIVE_NAME="${PROJ_NAME}#${BUILD_NUMBER}#Pro.xcarchive"
    LIBRARY_PATH="~/Library"
    ARCHIVE_PATH="${LIBRARY_PATH}/Developer/Xcode/Archives/${ARCHIVE_NAME}"
    DIS_TARGET="ad-hoc"
    EXPORT_OPTION_PATH="/Users/Shared/exportOptions/ad-hoc.plist"
    HOST_HEADER_PATH="/Users/Shared/exportOptions/hostConfig/HostConfig.h.pro.h"
    IPA_DIR="${PROJ_NAME}#${BUILD_NUMBER}"
    IPA_PATH="$/Users/Shared/Jenkins/Library/ipas/${IPA_DIR}/${DIS_TARGET}"
    PLIST_PATH="./${PROJ_NAME}/Info.plist"
    ENVIRONMENT_PATH="./${PROJ_NAME}/${PROJ_NAME}.entitlements"
    APP_NAME="知新点点"
    
    #修改HostConfig.h文件
    cp ${HOST_HEADER_PATH} ./${PROJ_NAME}/HostConfig.h
    
    #描述文件UUID
    PROFILE="d825a1ea-10ad-4de9-87d1-93884e98dc79"
    
    #证书名字
    IDENTITY="iPhone Distribution: Beijing Brilliant Insight Tree Technology Co., Ltd. (73HJR29D82)"
    
    #修改Xcode8中的自动签名改为手动管理
    sed -i '' 's/ProvisioningStyle = Automatic;/ProvisioningStyle = Manual;/' ./${PROJ_NAME}.xcodeproj/project.pbxproj
    
    #修改CFBundleVersion为jenkins的BUILD_NUMBER
    echo '修改${PLIST_PATH}中CFBundleVersion的值为${BUILD_NUMBER}'
    plutil -replace CFBundleVersion -string "${BUILD_NUMBER}" ${PLIST_PATH}
    
    #修改 CFBundleDisplayName
    echo '修改 ${PLIST_PATH} 中 CFBundleDisplayName 的值为${APP_NAME}'
    plutil -replace CFBundleDisplayName -string "${APP_NAME}" ${PLIST_PATH}
    
    #修改 aps-environment 的值 development/production
    echo '修改 ${ENVIRONMENT_PATH} 中 aps-environment 的值为 production'
    plutil -replace aps-environment -string "production" ${ENVIRONMENT_PATH}
    
    #开始编译 xcode签名不能设置为自动,只能使用手动管理签名方式
    xcodebuild -project ${PROJ_NAME}.xcodeproj -scheme ${PROJ_NAME} -archivePath "${ARCHIVE_PATH}" -configuration Release CODE_SIGN_IDENTITY="${IDENTITY}" PROVISIONING_PROFILE="${PROFILE}" archive 
    
    #导出ipa包
    xcodebuild -exportArchive -archivePath "${ARCHIVE_PATH}" -exportPath ${IPA_PATH} -exportOptionsPlist "${EXPORT_OPTION_PATH}" CODE_SIGN_IDENTITY=${IDENTITY} PROVISIONING_PROFILE=${PROFILE}
    
    #上传包到pgyer.com
    API_KEY="09d238dda37****9ef0fa1b04e590"
    USER_KEY="17dc2f6cafc****fcd24e41e16"
    curl -F "file=@${IPA_PATH}/${PROJ_NAME}.ipa" -F "uKey=${USER_KEY}" -F "_api_key=${API_KEY}" https://www.pgyer.com/apiv1/app/upload
  • 相关阅读:
    [CQOI2011]放棋子
    [CF1192B]动态直径
    [CERC2016]凸轮廓线
    19_08_14-19_08_21校内训练 补题
    [模板]线性递推+BM
    19_08_10[校内训练]割图
    [模板]多项式封装(无讲解)
    19_07_11校内训练[字串染色]
    CF990G
    19_07_09校内训练[分组]
  • 原文地址:https://www.cnblogs.com/icker/p/9066161.html
Copyright © 2020-2023  润新知