美文网首页
shell自动发布pod

shell自动发布pod

作者: Joshua520 | 来源:发表于2023-02-28 17:53 被阅读0次

    !/bin/sh

    path=1 cd "1"
    echo "\n ------ 获取目前版本号 ------ \n"
    for element in ls "$path" | tr " " "\?"
    do
    element=tr "\?" " " <<<$element
    dir_or_file="path"/"element"
    if [ -d "dir_or_file" ];then v1=( find "dir_or_file" -name '*.txt' ) ver2={v1##/}
    if [ -n "ver2" ];then ver1={ver2%.
    }
    array1=({ver1//-/ }) count1={#array1[@]}
    version1={array1[count1 - 1]} version1={version1//'/}
    fi
    else
    var=( find "element" -name '*.podspec' )
    var1={var##*/} fi done echo "file_name====var1 "
    echo "\n ------ 获取目前版本号 ------ \n"
    my_file={var1} search_str="spec.version" while read my_line do result=(echo {my_line} | grep "^{search_str}")
    if [ ["$result" != ""] ]
    then

        array=(${result// / })
        count=${#array[@]}
        p_version=${array[count - 1]}
        p_version=${p_version//\'/}
        if [ -n "$p_version" ];then
            podspec_version=${p_version}
        fi
    fi
    

    done < $my_file

    echo "podspec_version: podspec_version " echo "\n ------ 修改spec.version ------ \n" LineNumber=`grep -nE 'spec.version.*='{var1} | cut -d : -f1`
    sed -i "" "{LineNumber}s/{podspec_version}/""2\""/g"{var1}

    echo "\n ------ 修改检测版本号 ------ \n"
    find . -name *.txt | rename "s/version1/2/"

    find . -name *.txt | rename "s/"""/""/"

    find . -name *.txt | rename "s/"""/""/"

    echo "\n ------ git 本地提交代码操作 ------ \n"

    git 操作

    git add .
    git status
    git commit -m $podspec_version

    git推送到远端

    git tag $2
    git push origin master --tags

    echo "\n ------ 发布模块版本 ------ \n"
    pod repo push IOSMavenSpec ${var1} --allow-warnings --skip-import-validation

    相关文章

      网友评论

          本文标题:shell自动发布pod

          本文链接:https://www.haomeiwen.com/subject/fxblldtx.html