30.release-build.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. set -e
  2. # cd /root/docker/jenkins/workspace/sqler/svn/Publish/DevOps/sqler; bash 30.release-build.sh
  3. # export GIT_SSH_SECRET=xxxxxx
  4. #(x.1)当前路径
  5. curWorkDir=$PWD
  6. curPath=$(dirname $0)
  7. cd $curPath/../../..
  8. codePath=$PWD
  9. # codePath=/root/docker/jenkins/workspace/sqler/svn
  10. echo "(x.2)get version"
  11. #version=1.1.0.53
  12. cd $codePath
  13. version=`grep '<Version>' Sqler/Sqler.csproj | grep -o '[0-9\.]\+'`
  14. # echo $version
  15. #----------------------------------------------
  16. echo "(x.2)构建最终文件夹"
  17. mkdir -p $codePath/Publish/Sqler
  18. mkdir -p $codePath/Publish/git
  19. cp -rf $codePath/Publish/04.服务站点 $codePath/Publish/Sqler/04.服务站点
  20. cp -rf $codePath/Publish/06.Docker $codePath/Publish/Sqler/06.Docker
  21. cp -rf $codePath/Publish/06.Docker/制作镜像/sqler/app $codePath/Publish/Sqler/04.服务站点/Sqler
  22. docker run --rm -i \
  23. -v $codePath/Publish:/root/file \
  24. serset/filezip dotnet FileZip.dll zip -i /root/file/Sqler -o /root/file/git/Sqler${version}.zip
  25. #----------------------------------------------
  26. echo "(x.3)提交release文件到github"
  27. # releaseFile=$codePath/Publish/git/Sqler${version}.zip
  28. #复制ssh key
  29. cd $codePath/Publish
  30. echo "${GIT_SSH_SECRET}" > $codePath/Publish/git/serset
  31. chmod 600 $codePath/Publish/git/serset
  32. #推送到github
  33. docker run -i --rm -v $PWD/git:/root/git serset/git-client bash -c " \
  34. set -e
  35. ssh-agent bash -c \"
  36. ssh-add /root/git/serset
  37. ssh -T git@github.com -o StrictHostKeyChecking=no
  38. git config --global user.email 'serset@yeah.com'
  39. git config --global user.name 'lith'
  40. mkdir -p /root/code
  41. cd /root/code
  42. git clone git@github.com:serset/release.git /root/code
  43. mkdir -p /root/code/file/sqler
  44. cp /root/git/Sqler${version}.zip /root/code/file/sqler
  45. git add file/sqler/Sqler${version}.zip
  46. git commit -m 'auto commit ${version}'
  47. git push -u origin master \" "
  48. #(x.5)
  49. cd $curWorkDir