2017-05-09 01:45:50 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# set -x -u
|
|
|
|
# 上传二进制包到七牛
|
|
|
|
|
2017-05-09 06:37:40 +00:00
|
|
|
if [[ -z $QINIU_ACCESS_KEY || -z $QINIU_SECRET_KEY || -z $QINIU_URL ]];then
|
|
|
|
echo 'QINIU_ACCESS_KEY | QINIU_SECRET_KEY | QINIU_URL is need'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-05-09 01:45:50 +00:00
|
|
|
# 打包
|
|
|
|
for i in linux darwin windows
|
|
|
|
do
|
|
|
|
./build.sh -p $i
|
2017-05-17 05:34:44 +00:00
|
|
|
if [[ $? != 0 ]];then
|
2017-05-09 01:45:50 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-05-09 06:37:40 +00:00
|
|
|
# 身份认证
|
|
|
|
qrsctl login $QINIU_ACCESS_KEY $QINIU_SECRET_KEY
|
|
|
|
|
2017-05-09 01:45:50 +00:00
|
|
|
# 上传
|
|
|
|
for i in `ls gocron*.gz gocron*.zip`
|
|
|
|
do
|
|
|
|
# 上传文件 qrsctl put bucket key srcFile
|
2017-05-09 06:37:40 +00:00
|
|
|
KEY=gocron/$i
|
|
|
|
qrsctl put github $KEY $i
|
2017-05-17 05:34:44 +00:00
|
|
|
if [[ $? != 0 ]];then
|
2017-05-09 01:45:50 +00:00
|
|
|
break
|
|
|
|
fi
|
2017-05-09 06:37:40 +00:00
|
|
|
echo "刷新七牛CDN-" $QINIU_URL/$KEY
|
|
|
|
qrsctl cdn/refresh $QINIU_URL/$KEY
|
2017-05-09 01:45:50 +00:00
|
|
|
rm $i
|
|
|
|
done
|
|
|
|
|
|
|
|
echo '打包并上传成功'
|