Last active
February 26, 2022 23:54
-
-
Save luhui/20d427105ce5b7d59172 to your computer and use it in GitHub Desktop.
an ipa auto upload to fir shell using with jenkins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| fir_token="none" | |
| #获取shell文件所在的绝对路径 | |
| current_path=$(pwd) | |
| tmp_path=$(dirname $0) | |
| cd $tmp_path | |
| shell_path=$(pwd) | |
| cd $current_path | |
| #参数判断 | |
| project_path= | |
| while getopts d:t: opt | |
| do | |
| case "$opt" in | |
| d) project_path="$OPTARG";; | |
| t) fir_token="$OPTARG";; | |
| \?) # unknown flag | |
| echo >&2 \ | |
| "usage: $0 [-d directory>] [-e] [-l number] [-m message]" | |
| exit 1;; | |
| esac | |
| done | |
| shift `expr $OPTIND - 1` | |
| #工程绝对路径 | |
| cd $project_path | |
| project_path=$(pwd) | |
| #判断所输入路径是否是xcode工程的根路径 | |
| ls | grep .xcodeproj > /dev/null | |
| rtnValue=$? | |
| if [ $rtnValue != 0 ];then | |
| echo "Error!! The param must be the root path of a xcode project." | |
| exit | |
| fi | |
| #判断是否执行过ipa-build脚本 | |
| ls ./build/ipa-build/*.ipa &>/dev/null | |
| rtnValue=$? | |
| if [ $rtnValue != 0 ];then | |
| echo "Error!! No ipa files exists.Please run the \"ipa-build\" shell script first" | |
| exit | |
| fi | |
| #build文件夹路径 | |
| build_path=${project_path}/build/ipa-build | |
| #获取git的提交日志 | |
| echo "====== start git log ========" | |
| git_log=`curl "${BUILD_URL}api/xml?wrapper=changes&xpath=//changeSet//comment" -v` | |
| new_line='' | |
| git_log=${git_log//<changes>/} | |
| git_log=${git_log//<\/changes>/} | |
| git_log=${git_log//<comment>/} | |
| git_log=${git_log//<\/comment>/$new_line} | |
| echo $git_log | |
| echo "====== end git log ========" | |
| fir publish $build_path/*.ipa --token=$fir_token -c "$git_log" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment