记录一下jenkins自动构建android与ios安装包。
安装
Jenkins
1 | brew install jenkins-lts |
注意:2.263.4为正确运行的版本,如果通过uninstall后,可以在安装后手动替换掉war文件:1
cp -a /Developer/jenkins-war-2.263.4.war /usr/local/opt/jenkins-lts/libexec/jenkins.war
新版本的workspace默认为${ITEM_ROOT}/workspace,位于job目录下。需要修改~/.jenkins/config.xml文件的内容:1
<workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}</workspaceDir>
修改配置:
/usr/local/Cellar/jenkins-lts/2.289.1/homebrew.mxcl.jenkins-lts.plist:
1 | ... |
系统配置
没有采用jenkins插件方式安装,而是通过命令行shell脚本直接运行,所以需要事先在这台电脑上安装配置好相关的环境,并确保手动构建、打包功能正常,手动发布到appstore能成功。
android gradle配置:
1 | ext { |
nginx配置
安装:
1 | brew install nginx |
/usr/local/etc/nginx/nginx.conf:
1 | server { |
jenkins配置
安装Build Name and Description Setter插件,并Set Build Name的Build Name为:
1 | #${BUILD_NUMBER}_${PLATFORM}_${BUILD_TYPE}_${ENV}_${GIT_BRANCH} |
先安装Environment Injector Plugin插件,位置位于”Excute Shell”之后,配置Properties File Path为:
1 | /tmp/${JOB_NAME}-${ENV}-${BUILD_NUMBER}.properties |
Build->Execute shell:
1 | if [[ "$GIT_BRANCH" == "" || "$BUILD_TYPE" == "" || "$PLATFORM" == "" || "$ENV" == "" ]]; then |
参考脚本:
自动上传到app store请参考:https://testerhome.com/topics/10507
1 |
|
自动清理过期文件:
vim cleanHistoryFiles.sh
1 |
|
参考
- https://github.com/pluosi/app-host
- https://github.com/rock-app/fabu.love
- http://zhangzr.cn/2018/07/27/iOS%E5%BC%80%E5%8F%91-%E8%87%AA%E5%8A%A8%E6%89%93%E5%8C%85%E5%88%9D%E6%AD%A5%E6%8E%A2%E7%A9%B6/
- https://www.jianshu.com/p/38b2e17ced73
- https://juejin.im/post/5b6a542b5188251a9e171bf2
- https://blog.csdn.net/li530893850/article/details/70889763
- https://blog.csdn.net/zrina1314/article/details/80102199
- https://github.com/eventOneHQ/apkup
- https://stackoverflow.com/questions/14665518/api-to-automatically-upload-apk-to-google-play
- https://developers.google.com/android-publisher/getting_started