40.Station-publish.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. set -e
  2. #---------------------------------------------------------------------
  3. #(x.1)参数
  4. args_="
  5. export basePath=/root/temp/svn
  6. # "
  7. #----------------------------------------------
  8. echo "(x.2)获取netVersion"
  9. netVersion=`grep '<TargetFramework>' $(grep '<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
  10. publishPath=$basePath/Publish/release/release/Station\($netVersion\)
  11. echo publish Station
  12. echo dotnet version: $netVersion
  13. #----------------------------------------------
  14. echo "(x.3)查找所有需要发布的项目并发布"
  15. mkdir -p $publishPath
  16. docker run -i --rm \
  17. --env LANG=C.UTF-8 \
  18. -v $basePath/Publish/release/.nuget:/root/.nuget \
  19. -v $basePath:/root/code \
  20. serset/dotnet:sdk-6.0 \
  21. bash -c "
  22. set -e
  23. basePath=/root/code
  24. publishPath=\$basePath/Publish/release/release/Station\($netVersion\)
  25. #(x.3)查找所有需要发布的项目并发布
  26. cd \$basePath
  27. for file in \$(grep -a '<publish>' . -rl --include *.csproj)
  28. do
  29. cd \$basePath
  30. #get publishName
  31. publishName=\`grep '<publish>' \$file -r | grep -oP '>(.*)<' | tr -d '<>'\`
  32. echo publish \$publishName
  33. #publish
  34. cd \$(dirname \"\$file\")
  35. dotnet build --configuration Release
  36. dotnet publish --configuration Release --output \"\$publishPath/\$publishName\"
  37. #copy xml
  38. for filePath in bin/Release/$netVersion/*.xml ; do \\cp -rf \$filePath \"\$publishPath/\$publishName\";done
  39. done
  40. #(x.4)copy dir
  41. \cp -rf \$basePath/Publish/ReleaseFile/Station/. \"\$publishPath\"
  42. #(x.5)copy ServiceCenter
  43. mkdir -p \"\$basePath/Publish/release/release/ServiceCenter($netVersion)\"
  44. \cp -rf \$publishPath/ServiceCenter/. \"\$basePath/Publish/release/release/ServiceCenter($netVersion)/ServiceCenter\"
  45. \cp -rf \"\$publishPath/01.ServiceCenter.bat\" \"\$basePath/Publish/release/release/ServiceCenter($netVersion)\"
  46. \cp -rf \"\$publishPath/01.Start-4580.bat\" \"\$basePath/Publish/release/release/ServiceCenter($netVersion)\"
  47. "
  48. echo 'publish succeed!'