#!/bin/sh
echo "\033[31m \n -------自动打包开始,不能对项目进行操作------ \033[0m"
#进入项目目录
cd $(dirname $0)
#删除上一次生成的文件
rm -rf archive/GAS
rm -rf archive/GAS_archive
#展示当前路径
pwd
#-------------------------git 操作--------------------------------------
function gitAuto(){
echo "\033[32m \n ------- git begin ------ \n \033[0m"
git checkout -b autoBuild origin/autoBuild
#切换到自动打包的git分支
git checkout autoBuild
#更新一下代码
git merge development
echo "\033[32m \n ------- 查看一下最后一次更新的内容 ------- \033[0m"
#查看一下最后一次更新的内容
git log --graph -1
# 将最新代码推送到远端
git push
echo "\033[32m \n ------- git end ------- \033[0m"
}
#------------------------- build app--------------------------------------
function buildApp(){
echo "\033[32m \n ------- 开始打包 ------- \033[0m"
xcodebuild archive -workspace "GomeAfterSales.xcworkspace" -scheme "GomeAfterSales" -archivePath "archive/GAS_archive/archive.xcarchive"
echo "\033[32m \n ------- 打包结束 ------- \033[0m"
}
#------------------------- build app convert to ipa-----------------------------
function exportIPA(){
echo "\033[32m \n ------- 开始导出IPA ------- \033[0m"
xcodebuild -exportArchive -exportOptionsPlist "archive/exportOptions.plist" -archivePath "archive/GAS_archive/archive.xcarchive" -exportPath "archive/GAS"
echo "\033[32m \n ------- 导出IPA结束 IPA地址:/archive/GAS/GomeAfterSales.ipa ------- \033[0m"
}
#------------------------- pgyer upload --------------------------------------
function pgyerUpload(){
echo "\033[32m \n ------- 进入 archive/GAS ------- \033[0m"
cd archive/GAS
echo "\033[32m \n ------- 上传IPA到蒲公英 ------- \033[0m"
curl -F "file=@GomeAfterSales.ipa" -F "uKey= 910ed" -F "_api_key= f238c4f7" https://qiniu-storage.pgyer.com/apiv1/app/upload
}
#------------------------- git branch back --------------------------------------
function gitBack(){
echo "\033[32m \n ------- git branch back ------- \033[0m"
git checkout development
git branch -a
echo "\033[32m \n ------- git branch back ------- \033[0m"
}
gitAuto
buildApp
exportIPA
pgyerUpload
gitBack
网友评论