12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- set -e
- #---------------------------------------------------------------------
- #(x.1)参数
- args_="
- export codePath=/root/temp/svn
- # "
- #----------------------------------------------
- echo "(x.2)dotnet-publish"
- echo "dotnet version: ${netVersion}"
- mkdir -p $codePath/Publish/release/release/publish
- docker run -i --rm \
- --env LANG=C.UTF-8 \
- -v $codePath:/root/code \
- serset/dotnet:6.0-sdk \
- bash -c "
- set -e
- basePath=/root/code
- publishPath=\$basePath/Publish/release/release/publish
- #(x.3)查找所有需要发布的项目并发布
- cd \$basePath
- for file in \$(grep -a '<publish>' . -rl --include *.csproj)
- do
- cd \$basePath
-
- #get publishName
- publishName=\`grep '<publish>' \$file -r | grep -oP '>(.*)<' | tr -d '<>'\`
- echo publish \$publishName
- #publish
- cd \$(dirname \"\$file\")
- dotnet build --configuration Release
- dotnet publish --configuration Release --output \$publishPath/\$publishName
- done
- "
- #(x.4)copy bat
- \cp -rf $codePath/Publish/ReleaseFile/publish/. $codePath/Publish/release/release/publish
- echo 'publish succeed!'
|