美文网首页
远程ssh执行iOS打包脚本

远程ssh执行iOS打包脚本

作者: 弈梦 | 来源:发表于2018-12-28 17:08 被阅读0次
先上脚本代码:

首先需要安装一下 expect,关于expect的使用方式参考文末的链接

#!/usr/bin/expect
spawn ssh userxxx@192.168.86.200
expect {
    "*Password*" {send "123\r"; exp_continue}
}
// 非本机需要解锁keychain,要不然无法执行xcodeBuild
send "security unlock-keychain\r" 
expect {
    "*password*" {send "123\r"; exp_continue}
}
// 切换到项目目录,切换到需要打包的分支,拉取最新代码
send "cd /Users/dongyuan/xxxxxx\r"
send "git branch\r"
send "git checkout develop\r"
send "git pull\r"
// git账号、密码
expect {
    "*Username*" {send "xxxx@qq.com\r"; exp_continue}  
    "*Password*" {send "xxxx\r"; exp_continue}   
}
// 切换到脚本文件夹下,执行脚本
send "cd buildTool\r"
send "python /Users/xxx/xxx/buildTool/iosapp-package.py\r"
interact
参考文章:

自动化shell交互操作

相关文章

网友评论

      本文标题:远程ssh执行iOS打包脚本

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