40.Station-publish.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. set -e
  2. #---------------------------------------------------------------------
  3. # args
  4. args_="
  5. export basePath=/root/temp/svn
  6. export NUGET_PATH=$basePath/Publish/release/.nuget
  7. # "
  8. if [ ! $NUGET_PATH ]; then NUGET_PATH=$basePath/Publish/release/.nuget; fi
  9. #----------------------------------------------
  10. echo "40.Station-publish.sh find projects and build"
  11. docker run -i --rm \
  12. --env LANG=C.UTF-8 \
  13. -v $NUGET_PATH:/root/.nuget \
  14. -v $basePath:/root/code \
  15. serset/dotnet:sdk-6.0 \
  16. bash -c "
  17. set -e
  18. echo '#1 get netVersion'
  19. netVersion=\$(grep '<TargetFramework>' \$(grep '<publish>' -rl --include *.csproj /root/code | head -n 1) | grep -oP '>(.*)<' | tr -d '<>')
  20. echo netVersion: \$netVersion
  21. basePath=/root/code
  22. publishPath=\$basePath/Publish/release/release/Station\(\$netVersion\)
  23. mkdir -p \$publishPath
  24. echo '#2 publish Station'
  25. cd \$basePath
  26. for file in \$(grep -a '<publish>' . -rl --include *.csproj)
  27. do
  28. cd \$basePath
  29. #get publishName
  30. publishName=\`grep '<publish>' \$file -r | grep -oP '>(.*)<' | tr -d '<>'\`
  31. echo publish \$publishName
  32. #publish
  33. cd \$(dirname \"\$file\")
  34. dotnet build --configuration Release
  35. dotnet publish --configuration Release --output \"\$publishPath/\$publishName\"
  36. #copy xml
  37. for filePath in bin/Release/\$netVersion/*.xml ; do \\cp -rf \$filePath \"\$publishPath/\$publishName\";done
  38. done
  39. echo '#3 copy ReleaseFile'
  40. \cp -rf \$basePath/Publish/ReleaseFile/Station/. \"\$publishPath\"
  41. "
  42. echo 'publish succeed!'