90.release-build.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. set -e
  2. #---------------------------------------------------------------------
  3. #(x.1)参数
  4. args_="
  5. export codePath=/root/docker/jenkins/workspace/sqler/svn
  6. export version=`grep '<Version>' ${codePath} -r --include *.csproj | grep -oP '>(.*)<' | tr -d '<>'`
  7. export export GIT_SSH_SECRET=xxxxxx
  8. # "
  9. #----------------------------------------------
  10. echo "(x.2.1)发布文件-创建文件夹及内容"
  11. mkdir -p $codePath/Publish/git
  12. mkdir -p $codePath/Publish/release
  13. cp -rf $codePath/Publish/04.服务站点 $codePath/Publish/release/04.服务站点
  14. cp -rf $codePath/Publish/06.Docker $codePath/Publish/release/06.Docker
  15. cp -rf $codePath/Publish/06.Docker/制作镜像/${name}/app $codePath/Publish/release/04.服务站点/${name}
  16. echo "(x.2.3)发布文件-压缩"
  17. docker run --rm -i \
  18. -v $codePath/Publish:/root/file \
  19. serset/filezip dotnet FileZip.dll zip -i /root/file/release -o /root/file/git/${name}-${version}.zip
  20. #----------------------------------------------
  21. echo "(x.3)github-提交release文件到release仓库"
  22. # releaseFile=$codePath/Publish/git/${name}-${version}.zip
  23. #复制ssh key
  24. echo "${GIT_SSH_SECRET}" > $codePath/Publish/git/serset
  25. chmod 600 $codePath/Publish/git/serset
  26. #推送到github
  27. docker run -i --rm -v $codePath/Publish/git:/root/git serset/git-client bash -c " \
  28. set -e
  29. ssh-agent bash -c \"
  30. ssh-add /root/git/serset
  31. ssh -T git@github.com -o StrictHostKeyChecking=no
  32. git config --global user.email 'serset@yeah.com'
  33. git config --global user.name 'lith'
  34. mkdir -p /root/code
  35. cd /root/code
  36. git clone git@github.com:serset/release.git /root/code
  37. mkdir -p /root/code/file/${name}
  38. cp /root/git/${name}-${version}.zip /root/code/file/${name}
  39. git add file/${name}/${name}-${version}.zip
  40. git commit -m 'auto commit ${version}'
  41. git push -u origin master \" "