Selaa lähdekoodia

Merge branch 'release/1.3.16' of serset/ServiceAdaptor.NetCore into master

LithWang 1 vuosi sitten
vanhempi
commit
b92ff9b5fe
58 muutettua tiedostoa jossa 1452 lisäystä ja 808 poistoa
  1. 12 51
      .github/workflows/action-ki_multibranch.yml
  2. 2 3
      02.Gateway/ServiceAdaptor.NetCore.Gateway/ServiceAdaptor.NetCore.Gateway.csproj
  3. 2 2
      Library/ServiceAdaptor.NetCore.Consul/ServiceAdaptor.NetCore.Consul.csproj
  4. 1 1
      Library/ServiceAdaptor.NetCore.MinHttp/ServiceAdaptor.NetCore.MinHttp.csproj
  5. 2 2
      Library/ServiceAdaptor.NetCore.Sers/ServiceAdaptor.NetCore.Sers.csproj
  6. 3 3
      Library/ServiceAdaptor.NetCore/ServiceAdaptor.NetCore.csproj
  7. 0 46
      Publish/DevOps/build-bash/40.Station-publish-multiple.bash
  8. 0 74
      Publish/DevOps/build-bash/40.Station-publish.sh
  9. 0 43
      Publish/DevOps/build-bash/50.docker-image-create.sh
  10. 0 43
      Publish/DevOps/build-bash/startup.bash
  11. 0 50
      Publish/DevOps/github-bash/75.github-push-to-serset-release.sh
  12. 0 68
      Publish/DevOps/github-bash/startup.bash
  13. 0 17
      Publish/DevOps/jenkins-bash/00.svn-checkout.bash
  14. 0 39
      Publish/DevOps/jenkins-bash/01.svn-update.sh
  15. 0 47
      Publish/DevOps/jenkins-bash/release.jenkins.pipeline
  16. 0 57
      Publish/DevOps/jenkins-bash/startup.bash
  17. 0 70
      Publish/DevOps/release-bash/73.docker-image-build-push.sh
  18. 41 0
      Publish/DevOps3/build-bash/19.get-app-version.bash
  19. 46 0
      Publish/DevOps3/build-bash/20.change-app-version.bash
  20. 47 0
      Publish/DevOps3/build-bash/21.change-to-next-version.bash
  21. 41 0
      Publish/DevOps3/build-bash/22.add-suffix-to-app-version.bash
  22. 6 4
      Publish/DevOps3/build-bash/30.nuget-pack.sh
  23. 93 0
      Publish/DevOps3/build-bash/40.Station-publish.sh
  24. 23 0
      Publish/DevOps3/build-bash/41.extra-publish.sh
  25. 46 0
      Publish/DevOps3/build-bash/50.docker-image-copy.sh
  26. 8 7
      Publish/DevOps3/build-bash/51.docker-deploy-copy.sh
  27. 23 0
      Publish/DevOps3/build-bash/52.docker-extra-copy.sh
  28. 32 0
      Publish/DevOps3/build-bash/startup.bash
  29. 4 4
      Publish/DevOps3/build-cmd/30.nuget-pack.bat
  30. 31 0
      Publish/DevOps3/build-cmd/40.Station-publish(net5.0).bat
  31. 31 0
      Publish/DevOps3/build-cmd/40.Station-publish(netcoreapp2.1).bat
  32. 57 0
      Publish/DevOps3/build-cmd/40.Station-publish.bat
  33. 97 0
      Publish/DevOps3/build-cmd/41.StressTest-publish.bat
  34. 36 0
      Publish/DevOps3/build-cmd/50.docker-image-create.bat
  35. 36 0
      Publish/DevOps3/build-cmd/51.docker-deploy-copy.bat
  36. 8 8
      Publish/DevOps3/build-cmd/Clean-All.bat
  37. 1 0
      Publish/DevOps3/build-cmd/Clean-ReleaseFiles.bat
  38. 21 0
      Publish/DevOps3/build-cmd/OneKey Release.bat
  39. 45 45
      Publish/DevOps3/build-cmd/Version-To-NextTemp.bat
  40. 45 45
      Publish/DevOps3/build-cmd/Version-To-Preview.bat
  41. 42 42
      Publish/DevOps3/build-cmd/Version-To-Release.bat
  42. 32 0
      Publish/DevOps3/build-cmd/Version-getVersion.bat
  43. 0 0
      Publish/DevOps3/build-cmd/VsTool.exe
  44. 1 0
      Publish/DevOps3/environment/env.APPNAME.txt
  45. 1 0
      Publish/DevOps3/environment/env.envName.txt
  46. 13 0
      Publish/DevOps3/environment/readme.md
  47. 30 0
      Publish/DevOps3/github-bash/74.github-push-to-webdav.sh
  48. 12 11
      Publish/DevOps3/github-bash/76.github-push-release.sh
  49. 70 0
      Publish/DevOps3/github-bash/startup.bash
  50. 168 0
      Publish/DevOps3/jenkins-bash/CICD.ki.git_Multibranch.deploy.jenkinsfile
  51. 10 4
      Publish/DevOps3/release-bash/71.file-zip.sh
  52. 10 7
      Publish/DevOps3/release-bash/72.nuget-push.sh
  53. 39 0
      Publish/DevOps3/release-bash/73.docker-image-build-push.sh
  54. 41 0
      Publish/DevOps3/release-bash/74.docker-image-build-push_amd64.bash
  55. 71 0
      Publish/DevOps3/release-bash/75.docker-image-build-push_cross.bash
  56. 47 0
      Publish/DevOps3/release-bash/78.push-releaseFiles-to-webdav.bash
  57. 15 15
      Publish/DevOps3/release-bash/startup.bash
  58. 10 0
      clean-temp.bat

+ 12 - 51
.github/workflows/action-main.yml → .github/workflows/action-ki_multibranch.yml

@@ -1,16 +1,20 @@
 # This is a basic workflow to help you get started with Actions
 
-name: CI
+name: ki_multibranch_3.1
 
 # Controls when the action will run. 
 on:
   
   push:
+    # Triggers the workflow on push events for the branches start with release
+    branches:
+      - 'release/**'
+
     # Triggers the workflow on push events but only for the master branch
     #branches: [ master ]
 
     # Triggers the workflow on push tag
-    tags: ['*']
+    #tags: ['*']
     
   # Allows you to run this workflow manually from the Actions tab
   workflow_dispatch:
@@ -32,17 +36,19 @@ jobs:
         run: |
            set -e
            echo start build
-           export APPNAME="ServiceAdaptor"
+
+           export DOCKER_ImagePrefix="serset/"
            export DOCKER_USERNAME="${{ secrets.DOCKER_USERNAME  }}"
            export DOCKER_PASSWORD="${{ secrets.DOCKER_PASSWORD }}"
            export NUGET_SERVER="${{ secrets.NUGET_SERVER  }}"
            export NUGET_KEY="${{ secrets.NUGET_KEY }}"
-           export GIT_SSH_SECRET="${{ secrets.GIT_SSH_SECRET }}"
-           cd ./Publish/DevOps/github-bash
+           export WebDav_BaseUrl="${{ secrets.WebDav_BaseUrl }}"
+           export WebDav_User="${{ secrets.WebDav_User }}"
+           cd ./Publish/DevOps3/github-bash
            bash startup.bash
            echo build succeed!
            
-           echo "appName=ServiceAdaptor" >> $GITHUB_ENV
+           # echo "appName=${APPNAME}" >> $GITHUB_ENV
            
            
       - name: release_create
@@ -90,15 +96,6 @@ jobs:
 
 
 
-      - uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.release_create.outputs.upload_url }}
-          asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(net5.0)-${{ env.release_version }}.zip
-          asset_name: ${{ env.appName }}-Station-net5.0-${{ env.release_version }}.zip
-          asset_content_type: application/zip
-
       - uses: actions/upload-release-asset@v1
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -107,39 +104,3 @@ jobs:
           asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(net6.0)-${{ env.release_version }}.zip
           asset_name: ${{ env.appName }}-Station-net6.0-${{ env.release_version }}.zip
           asset_content_type: application/zip
-
-      - uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.release_create.outputs.upload_url }}
-          asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(netcoreapp2.1)-${{ env.release_version }}.zip
-          asset_name: ${{ env.appName }}-Station-netcoreapp2.1-${{ env.release_version }}.zip
-          asset_content_type: application/zip
-
-      - uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.release_create.outputs.upload_url }}
-          asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(netcoreapp2.2)-${{ env.release_version }}.zip
-          asset_name: ${{ env.appName }}-Station-netcoreapp2.2-${{ env.release_version }}.zip
-          asset_content_type: application/zip
-
-      - uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.release_create.outputs.upload_url }}
-          asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(netcoreapp3.0)-${{ env.release_version }}.zip
-          asset_name: ${{ env.appName }}-Station-netcoreapp3.0-${{ env.release_version }}.zip
-          asset_content_type: application/zip
-
-      - uses: actions/upload-release-asset@v1
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ steps.release_create.outputs.upload_url }}
-          asset_path: ${{ env.release_dirPath }}/${{ env.appName }}-Station(netcoreapp3.1)-${{ env.release_version }}.zip
-          asset_name: ${{ env.appName }}-Station-netcoreapp3.1-${{ env.release_version }}.zip
-          asset_content_type: application/zip

+ 2 - 3
02.Gateway/ServiceAdaptor.NetCore.Gateway/ServiceAdaptor.NetCore.Gateway.csproj

@@ -7,7 +7,7 @@
 
     <PropertyGroup>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>1.3.15</Version>
+        <Version>1.3.16</Version>
     </PropertyGroup>
 
     <PropertyGroup>
@@ -17,7 +17,7 @@
     </PropertyGroup>
 
     <PropertyGroup>
-        <DocumentationFile>bin\Debug\netstandard2.0\ServiceAdaptor.NetCore.Gateway.xml</DocumentationFile>
+        <DocumentationFile>bin\Debug\net6.0\ServiceAdaptor.NetCore.Gateway.xml</DocumentationFile>
     </PropertyGroup>
 
     <ItemGroup>
@@ -32,7 +32,6 @@
         <ProjectReference Include="..\..\Library\ServiceAdaptor.NetCore.MinHttp\ServiceAdaptor.NetCore.MinHttp.csproj" />
         <ProjectReference Include="..\..\Library\ServiceAdaptor.NetCore.Consul\ServiceAdaptor.NetCore.Consul.csproj" />
         <ProjectReference Include="..\..\Library\ServiceAdaptor.NetCore.Sers\ServiceAdaptor.NetCore.Sers.csproj" />
-        <!--<ProjectReference Include="..\..\Library\ServiceAdaptor.NetCore.Be.Eureka\ServiceAdaptor.NetCore.Be.Eureka.csproj" />-->
     </ItemGroup>
 
 

+ 2 - 2
Library/ServiceAdaptor.NetCore.Consul/ServiceAdaptor.NetCore.Consul.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>1.3.15</Version>
+        <Version>1.3.16</Version>
     </PropertyGroup>
 
     <PropertyGroup>
@@ -21,7 +21,7 @@
 
     <ItemGroup>
         <PackageReference Include="Consul" Version="0.7.2.6" />
-        <PackageReference Include="Vit.WebHost" Version="2.1.19" />
+        <PackageReference Include="Vit.WebHost" Version="2.1.21" />
     </ItemGroup>
 
 

+ 1 - 1
Library/ServiceAdaptor.NetCore.MinHttp/ServiceAdaptor.NetCore.MinHttp.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>1.3.15</Version>
+        <Version>1.3.16</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 2 - 2
Library/ServiceAdaptor.NetCore.Sers/ServiceAdaptor.NetCore.Sers.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>1.3.15</Version>
+        <Version>1.3.16</Version>
     </PropertyGroup>
 
     <PropertyGroup>
@@ -21,7 +21,7 @@
 
     <ItemGroup>
         <!-- Sers -->
-        <PackageReference Include="Sers.Serslot" Version="2.1.22" />
+        <PackageReference Include="Sers.Serslot" Version="2.1.24" />
     </ItemGroup>
 
     <ItemGroup>

+ 3 - 3
Library/ServiceAdaptor.NetCore/ServiceAdaptor.NetCore.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>1.3.15</Version>
+        <Version>1.3.16</Version>
     </PropertyGroup>
 
     <PropertyGroup>
@@ -20,10 +20,10 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.1.0" />
+        <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.1.1" />
 
         <!-- Sers -->
-        <PackageReference Include="Vit.Core" Version="2.1.19" />
+        <PackageReference Include="Vit.Core" Version="2.1.21" />
     </ItemGroup>
 
 

+ 0 - 46
Publish/DevOps/build-bash/40.Station-publish-multiple.bash

@@ -1,46 +0,0 @@
-set -e
-
-
-#---------------------------------------------------------------------
-# args
-args_="
-
-export basePath=/root/temp/svn
-export NUGET_PATH=$basePath/Publish/release/.nuget
-
-# "
-
-
-curPath=$PWD
-
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
-
-#----------------------------------------------
-echo "40.Station-publish-multiple.bash"
-
-for netVersion in net5.0 netcoreapp3.1 netcoreapp3.0 netcoreapp2.2 netcoreapp2.1
-do
-	echo "#2.1 publish netVersion: $netVersion"
-
-	echo "#2.2 change netVersion to $netVersion in csproj"
-	sed -i 's/net6.0/'"$netVersion"'/g' `find ${basePath} -name *.csproj -exec grep '<publish>' -l {} \;`
-
-
-	echo "#2.3 sh 40.Station-publish.sh"
-	cd $curPath
-	sh 40.Station-publish.sh
-
-
-	echo "#2.4 change back netVersion to net6.0 in csproj"
-	sed -i 's/'"$netVersion"'/net6.0/g' `find ${basePath} -name *.csproj -exec grep '<publish>' -l {} \;`
-
-done
-
-
-
-cd $curPath
-
-
-

+ 0 - 74
Publish/DevOps/build-bash/40.Station-publish.sh

@@ -1,74 +0,0 @@
-set -e
-
-
-#---------------------------------------------------------------------
-# args
-args_="
-
-export basePath=/root/temp/svn
-export NUGET_PATH=$basePath/Publish/release/.nuget
-
-# "
-
-if [ ! $NUGET_PATH ]; then NUGET_PATH=$basePath/Publish/release/.nuget; fi
-
-
-#----------------------------------------------
-echo "40.Station-publish.sh find projects and build"
-
-
-
-
-docker run -i --rm \
---env LANG=C.UTF-8 \
--v $NUGET_PATH:/root/.nuget \
--v $basePath:/root/code \
-serset/dotnet:sdk-6.0 \
-bash -c "
-set -e
-
-echo '#1 get netVersion'
-netVersion=\$(grep '<TargetFramework>' \$(grep '<publish>' -rl --include *.csproj /root/code | head -n 1) | grep -oP '>(.*)<' | tr -d '<>')
-echo netVersion: \$netVersion
-
-
-basePath=/root/code
-publishPath=\$basePath/Publish/release/release/Station\(\$netVersion\)
-mkdir -p \$publishPath
-
-echo '#2 publish Station'
-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\"
-
-	#copy xml
-	for filePath in bin/Release/\$netVersion/*.xml ; do \\cp -rf \$filePath \"\$publishPath/\$publishName\";done
-done
-
-
-echo '#3 copy ReleaseFile'
-\cp -rf \$basePath/Publish/ReleaseFile/Station/. \"\$publishPath\"
-
-
-
-"
-
-
-
-echo 'publish succeed!'
-
-
-
-
-

+ 0 - 43
Publish/DevOps/build-bash/50.docker-image-create.sh

@@ -1,43 +0,0 @@
-set -e
-
-
-#---------------------------------------------------------------------
-#(x.1)参数
-args_="
-
-export basePath=/root/temp/svn
-
-# "
-
- 
-#---------------------------------------------------------------------
-#(x.2)
-publishPath="$basePath/Publish/release/release/Station(net6.0)"
-dockerPath=$basePath/Publish/release/release/docker-image
-
-
-
-#---------------------------------------------------------------------
-echo "(x.3)copy dir"
-\cp -rf "$basePath/Publish/ReleaseFile/docker-image/." "$dockerPath"
-
-
-#---------------------------------------------------------------------
-echo "(x.4)copy station"
-#查找所有需要发布的项目并copy
-cd $basePath
-for file in $(grep -a '<docker>' . -rl --include *.csproj)
-do
-	cd $basePath
-	
-	#get publishName
-	publishName=`grep '<publish>' $file -r | grep -oP '>(.*)<' | tr -d '<>'`
-	
-	#get dockerName
-	dockerName=`grep '<docker>' $file -r | grep -oP '>(.*)<' | tr -d '<>'`
-
-	echo copy $dockerName
-	\cp -rf "$publishPath/$publishName/." "$dockerPath/$dockerName/app"
-done
-
-

+ 0 - 43
Publish/DevOps/build-bash/startup.bash

@@ -1,43 +0,0 @@
-set -e
-
-# cd /root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/Sers/code/Publish/DevOps/build-bash;bash startup.bash;
-
-#----------------------------------------------
-#(x.1)当前路径 
-curPath=$PWD
-
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
-
-
-
-
-
-#----------------------------------------------
-echo "(x.2)get version" 
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
-echo $version
-
- 
-
-
-#----------------------------------------------
-echo "(x.3)自动发布 $name-$version"
-
-for file in *.sh
-do
-    echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    echo "[$(date "+%H:%M:%S")]" bash $file
-    bash $file
-done
-
-
-
-
-
-
- 
-#----------------------------------------------
-#(x.9)
-cd $curPath

+ 0 - 50
Publish/DevOps/github-bash/75.github-push-to-serset-release.sh

@@ -1,50 +0,0 @@
-set -e
-
-
-#---------------------------------------------------------------------
-#(x.1)参数
-args_="
-
-export basePath=/root/temp/svn
-
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
-
-export APPNAME=xxxxxx
-
-export GIT_SSH_SECRET=xxxxxx
-
-# "
-
-
-
-
-
-#----------------------------------------------
-echo "github-提交release文件到serset/release仓库"
-# releaseFile=$basePath/Publish/release/release-zip
-
-#复制ssh key
-echo "${GIT_SSH_SECRET}" > $basePath/Publish/release/serset
-chmod 600 $basePath/Publish/release/serset
-
-#推送到github
-docker run -i --rm \
--v $basePath/Publish/release:/root/release serset/git-client bash -c "
-set -e
-ssh-agent bash -c \"
-ssh-add /root/release/serset
-ssh -T git@github.com -o StrictHostKeyChecking=no
-git config --global user.email 'serset@yeah.com'
-git config --global user.name 'lith'
-mkdir -p /root/code
-cd /root/code
-git clone git@github.com:serset/release.git /root/code
-mkdir -p /root/code/file/${APPNAME}/${APPNAME}-${version}
-\\cp -rf  /root/release/release-zip/. /root/code/file/${APPNAME}/${APPNAME}-${version}
-git add /root/code/file/${APPNAME}/${APPNAME}-${version}/.
-git commit -m 'auto commit ${version}'
-git push -u origin master \" "
-
-
- 
- 

+ 0 - 68
Publish/DevOps/github-bash/startup.bash

@@ -1,68 +0,0 @@
-set -e
-
-# cd /root/temp/svn/Publish/DevOps/github-bash;bash startup.bash;
-
-#---------------------------------------------------------------------
-#(x.1)参数
-args_="
-
-export APPNAME=xxxxxx
-
-export DOCKER_USERNAME=serset
-export DOCKER_PASSWORD=xxxxxx
-
-export NUGET_SERVER=https://api.nuget.org/v3/index.json
-export NUGET_KEY=xxxxxx
-
-export GIT_SSH_SECRET=xxxxxx
-
-# "
-
-#----------------------------------------------
-#(x.2)当前路径
-curPath=$PWD
-
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
-
-# export basePath=/root/temp/svn
-
-
-
-#---------------------------------------------- 
-echo '(x.4)build'
-cd $basePath/Publish/DevOps/build-bash; bash startup.bash;
-cd $basePath/Publish/DevOps/build-bash; bash 40.Station-publish-multiple.bash;
-
-
-
-#---------------------------------------------- 
-echo '(x.5)release-bash'
-cd $basePath/Publish/DevOps/release-bash; bash startup.bash;
- 
-
-
-#----------------------------------------------
-echo "(x.3)get version" 
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
-echo $version
-
-
-
-#----------------------------------------------
-#(x.4)bash
-cd $curPath
-for file in *.sh
-do
-    echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    echo "[$(date "+%H:%M:%S")]" bash $file
-    bash $file
-done
-
-
-
-
-
-
-

+ 0 - 17
Publish/DevOps/jenkins-bash/00.svn-checkout.bash

@@ -1,17 +0,0 @@
-
-#(x.1)参数
-basePath=/root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/ServiceAdaptor
-export SVN_PATH=svn://svn.ki.lith.cloud/2020LithProject/ServiceAdaptor/ServiceAdaptor
-export SVN_USERNAME=jenkins
-export SVN_PASSWORD=xxxxxx
-
-
-#(x.2)创建文件夹
-mkdir -p $basePath/code
-chmod 777 $basePath/code
-
-
-
-#(x.3)从svn拉取code
-docker run -it --rm -v $basePath/code:/root/svn serset/svn-client svn checkout "$SVN_PATH" /root/svn --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --no-auth-cache
-

+ 0 - 39
Publish/DevOps/jenkins-bash/01.svn-update.sh

@@ -1,39 +0,0 @@
-set -e
-
-# cd /root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/Sers/code/Publish/DevOps/jenkins-bash; bash 01.svn-update.sh
-
-#---------------------------------------------------------------------
-#(x.1)参数
-args_="
-export SVN_USERNAME=jenkins
-export SVN_PASSWORD=xxxxxx
-# "
-
-
-#---------------------------------------------------------------------
-#(x.2)当前路径
-curPath=$PWD
-
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
-
-# export basePath=/root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/Sers/code
-
-
-
-#---------------------------------------------------------------------
-#(x.3)cleanup
-docker run -i --rm -v $basePath:/root/svn serset/svn-client svn cleanup /root/svn --remove-unversioned
-
-
-#(x.4)revert
-docker run -i --rm -v $basePath:/root/svn serset/svn-client svn revert /root/svn -R
-
-
-#(x.5)拉取最新代码
-docker run -i --rm -v $basePath:/root/svn serset/svn-client svn update /root/svn --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --no-auth-cache
-
-
-
-cd $curPath

+ 0 - 47
Publish/DevOps/jenkins-bash/release.jenkins.pipeline

@@ -1,47 +0,0 @@
-pipeline { 
-    agent none
-
-    environment {
-        basePath = "/root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/ServiceAdaptor/code"
-        APPNAME = "ServiceAdaptor"
-        SVN_USERNAME = "jenkins"
-        SVN_PASSWORD = "xxxxxx"
-        DOCKER_USERNAME = "serset"
-        DOCKER_PASSWORD = "xxxxxx"
-        NUGET_SERVER = "https://api.nuget.org/v3/index.json"
-        NUGET_KEY = "xxxxxx"
-        NUGET_PATH = "/root/docker-data/dev/jenkins/jenkins_home/workspace/.nuget"
-    }
-    stages {
-        stage('(x.0)confirm') { 
-            agent any 
-            steps {
-                timeout(10) {
-                    script { 
-                        inputData = input message: "Are you sure to build and release?", ok: 'Proceed?', parameters: [string(defaultValue: '', description: 'text comment', name: 'comment')], submitterParameter: 'APPROVER' 
-                    } 
-                }
-            } 
-        }
-        stage('(x.1)svn-update') { 
-            agent any 
-            steps {
-                sh "chroot /host bash -c 'set -e; export APPNAME=$APPNAME;export SVN_USERNAME=$SVN_USERNAME;export SVN_PASSWORD=$SVN_PASSWORD;export DOCKER_USERNAME=$DOCKER_USERNAME;export DOCKER_PASSWORD=$DOCKER_PASSWORD;export NUGET_KEY=$NUGET_KEY;export NUGET_SERVER=$NUGET_SERVER;export NUGET_PATH=$NUGET_PATH;    cd $basePath/Publish/DevOps/jenkins-bash;bash 01.svn-update.sh;  '"
-            } 
-        }
-
-        stage('(x.4)build') {
-            agent any 
-            steps {
-                sh "chroot /host bash -c 'set -e; export APPNAME=$APPNAME;export SVN_USERNAME=$SVN_USERNAME;export SVN_PASSWORD=$SVN_PASSWORD;export DOCKER_USERNAME=$DOCKER_USERNAME;export DOCKER_PASSWORD=$DOCKER_PASSWORD;export NUGET_KEY=$NUGET_KEY;export NUGET_SERVER=$NUGET_SERVER;export NUGET_PATH=$NUGET_PATH;    cd $basePath/Publish/DevOps/build-bash; bash startup.bash;  '"
-            } 
-        }
-
-        stage('(x.5)release-bash') { 
-            agent any 
-            steps {
-                sh "chroot /host bash -c 'set -e; export APPNAME=$APPNAME;export SVN_USERNAME=$SVN_USERNAME;export SVN_PASSWORD=$SVN_PASSWORD;export DOCKER_USERNAME=$DOCKER_USERNAME;export DOCKER_PASSWORD=$DOCKER_PASSWORD;export NUGET_KEY=$NUGET_KEY;export NUGET_SERVER=$NUGET_SERVER;export NUGET_PATH=$NUGET_PATH;    cd $basePath/Publish/DevOps/release-bash; bash startup.bash;  '"
-            } 
-        }
-    } 
-} 

+ 0 - 57
Publish/DevOps/jenkins-bash/startup.bash

@@ -1,57 +0,0 @@
-set -e
-
-
-# cd /root/docker-data/dev/jenkins/jenkins_home/workspace/Repo/Sers/code/Publish/DevOps/jenkins-bash; bash startup.bash;
-
-#---------------------------------------------------------------------
-#(x.1)²ÎÊý
-args_="
-export APPNAME=xxxxxx
-
-export SVN_USERNAME=jenkins
-export SVN_PASSWORD=xxxxxx
-
-export DOCKER_USERNAME=serset
-export DOCKER_PASSWORD=xxxxxx
-
-export NUGET_SERVER=https://api.nuget.org/v3/index.json
-export NUGET_KEY=xxxxxx
-
-export NUGET_PATH=/root/docker-data/dev/jenkins/jenkins_home/workspace/.nuget
-
-# "
-
-#----------------------------------------------
-#(x.2)µ±Ç°Â·¾¶ 
-curPath=$PWD
-
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
-
-# export basePath=/root/temp/svn
-
-
-
-#----------------------------------------------
-echo '(x.3)svn-update'
-bash 01.svn-update.sh;
-
-
- 
-
-#---------------------------------------------- 
-echo '(x.4)build'
-cd $basePath/Publish/DevOps/build-bash; bash startup.bash;
-
-
-#---------------------------------------------- 
-echo '(x.5)release-bash'
-cd $basePath/Publish/DevOps/release-bash; bash startup.bash;
- 
-
-
-
-#----------------------------------------------
-#(x.9)
-#cd $curPath

+ 0 - 70
Publish/DevOps/release-bash/73.docker-image-build-push.sh

@@ -1,70 +0,0 @@
-set -e
-
-
-#---------------------------------------------------------------------
-#(x.1)参数
-args_="
-
-export basePath=/root/temp/svn
-
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
-
-export DOCKER_USERNAME=serset
-export DOCKER_PASSWORD=xxx
-
-# "
-
-
-
-
-#---------------------------------------------------------------------
-echo "(x.2)docker - init buildx"
-
-echo "开启实验特性"
-export DOCKER_CLI_EXPERIMENTAL=enabled
-
-echo "验证是否开启"
-docker buildx version
-
-echo "启用binfmt_misc"
-docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
-
-echo "验证binfmt_misc是否开启"
-ls -al /proc/sys/fs/binfmt_misc/
-
-
-echo "创建构建器"
-if [ ! "$(docker buildx ls | grep mybuilder)" ]; then docker buildx create --use --name mybuilder; fi
-
-echo "启动构建器"
-docker buildx inspect mybuilder --bootstrap
-
-echo "查看当前使用的构建器及构建器支持的CPU架构"
-docker buildx ls
-
-
-
-#---------------------------------------------------------------------
-echo "(x.3)docker - build and push"
-
-docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
-
-
-dockerPath=$basePath/Publish/release/release/docker-image
-
-for dockerName in `ls $dockerPath`
-do
-  if [ -d $dockerPath/$dockerName ]
-  then
-    platform="linux/amd64,linux/arm64,linux/arm/v7"
-    if [ -f "$dockerPath/$dockerName/Dockerfile.platform" ]; then platform=`cat "$dockerPath/$dockerName/Dockerfile.platform"`; fi
-
-    echo "docker build $dockerName, platform: $platform"
-    docker buildx build $dockerPath/$dockerName -t $DOCKER_USERNAME/$dockerName:$version -t $DOCKER_USERNAME/$dockerName --platform=$platform --push
-  fi
-done
-
-
-#---------------------------------------------------------------------
-echo "(x.4)docker - remove buildx"
-if [ "$(docker buildx ls | grep mybuilder)" ]; then docker buildx rm mybuilder; fi

+ 41 - 0
Publish/DevOps3/build-bash/19.get-app-version.bash

@@ -0,0 +1,41 @@
+set -e
+
+# export versionSuffix='.1234.preview'
+# bash 19.get-app-version.bash
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export versionSuffix='  '
+
+# "
+
+# remove spaces
+versionSuffix=${versionSuffix// /}
+
+#----------------------------------------------
+# basePath
+if [ -z "$basePath" ]; then basePath=$PWD/../../..; fi
+
+
+
+#----------------------------------------------
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
+echo "appVersion from csproj: $appVersion"
+
+# get v1 v2 v3
+v1=$(echo $appVersion | tr '.' '\n' | sed -n 1p)
+v2=$(echo $appVersion | tr '.' '\n' | sed -n 2p)
+v3=$(echo $appVersion | tr '.-' '\n' | sed -n 3p)
+
+
+#export nextAppVersion="${appVersion%%-*}$versionSuffix"
+export nextAppVersion="$v1.$v2.$v3$versionSuffix"
+echo "nextAppVersion: $nextAppVersion"
+

+ 46 - 0
Publish/DevOps3/build-bash/20.change-app-version.bash

@@ -0,0 +1,46 @@
+set -e
+
+# export versionSuffix='.1234.preview'
+# bash 20.change-app-version.bash
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export versionSuffix='  '
+
+# "
+
+# remove spaces
+versionSuffix=${versionSuffix// /}
+
+#----------------------------------------------
+# basePath
+if [ -z "$basePath" ]; then basePath=$PWD/../../..; fi
+
+
+
+#----------------------------------------------
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
+echo "appVersion from csproj: $appVersion"
+
+# get v1 v2 v3
+v1=$(echo $appVersion | tr '.' '\n' | sed -n 1p)
+v2=$(echo $appVersion | tr '.' '\n' | sed -n 2p)
+v3=$(echo $appVersion | tr '.-' '\n' | sed -n 3p)
+
+
+#export nextAppVersion="${appVersion%%-*}$versionSuffix"
+export nextAppVersion="$v1.$v2.$v3$versionSuffix"
+echo "nextAppVersion: $nextAppVersion"
+
+
+#----------------------------------------------
+echo "#2 change app version from [$appVersion] to [$nextAppVersion]" 
+sed -i 's/'"$appVersion"'/'"$nextAppVersion"'/g'  `find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \;`
+

+ 47 - 0
Publish/DevOps3/build-bash/21.change-to-next-version.bash

@@ -0,0 +1,47 @@
+set -e
+
+# export versionSuffix='.1234.preview'
+# bash 21.change-to-next-version.bash
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export versionSuffix='  '
+
+# "
+
+# remove spaces
+versionSuffix=${versionSuffix// /}
+
+#----------------------------------------------
+# basePath
+if [ -z "$basePath" ]; then basePath=$PWD/../../..; fi
+
+
+
+#----------------------------------------------
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
+echo "appVersion from csproj: $appVersion"
+
+# get v1 v2 v3
+v1=$(echo $appVersion | tr '.' '\n' | sed -n 1p)
+v2=$(echo $appVersion | tr '.' '\n' | sed -n 2p)
+v3=$(echo $appVersion | tr '.-' '\n' | sed -n 3p)
+((v3++));
+
+
+#export nextAppVersion="${appVersion%%-*}$versionSuffix"
+export nextAppVersion="$v1.$v2.$v3$versionSuffix"
+echo "nextAppVersion: $nextAppVersion"
+
+#----------------------------------------------
+echo "#2 change app version from [$appVersion] to [$nextAppVersion]" 
+sed -i 's/'"$appVersion"'/'"$nextAppVersion"'/g'  `find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \;`
+
+

+ 41 - 0
Publish/DevOps3/build-bash/22.add-suffix-to-app-version.bash

@@ -0,0 +1,41 @@
+set -e
+
+# export versionSuffix='.1234.preview'
+# bash 22.add-suffix-to-app-version.bash
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export versionSuffix='  '
+
+# "
+
+# remove spaces
+versionSuffix=${versionSuffix// /}
+
+#----------------------------------------------
+# basePath
+if [ -z "$basePath" ]; then basePath=$PWD/../../..; fi
+
+
+
+#----------------------------------------------
+echo "#1 get appVersion"
+# get csproj file with appVersion tag, if not exist get file with pack or publish tag
+csprojPath=$(find ${basePath} -name *.csproj -exec grep '<appVersion>' -l {} \; | head -n 1);
+if [ ! -f "$csprojPath" ]; then csprojPath=$(find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \; | head -n 1);  fi
+if [ -f "$csprojPath" ]; then export appVersion=`grep '<Version>' "$csprojPath" | grep -oE '\>(.*)\<' | tr -d '<>/'`;  fi
+echo "appVersion from csproj: $appVersion"
+
+
+
+export nextAppVersion="${appVersion}${versionSuffix}"
+echo "nextAppVersion: $nextAppVersion"
+
+
+#----------------------------------------------
+echo "#2 change app version from [$appVersion] to [$nextAppVersion]" 
+sed -i 's/'"$appVersion"'/'"$nextAppVersion"'/g'  `find ${basePath} -name *.csproj -exec grep '<pack>\|<publish>' -l {} \;`
+

+ 6 - 4
Publish/DevOps/build-bash/30.nuget-pack.sh → Publish/DevOps3/build-bash/30.nuget-pack.sh

@@ -4,7 +4,7 @@ set -e
 
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export basePath=/root/temp/svn
@@ -14,13 +14,14 @@ export NUGET_PATH=$basePath/Publish/release/.nuget
 
 if [ ! $NUGET_PATH ]; then NUGET_PATH=$basePath/Publish/release/.nuget; fi
 
-mkdir -p $basePath/Publish/release/release/nuget
+
 nugetPath=Publish/release/release/nuget
+mkdir -p $basePath/Publish/release/release
 
 
 
 #----------------------------------------------
-echo "(x.2)nuget-pack"
+echo "30.nuget-pack.sh"
 docker run -i --rm \
 --env LANG=C.UTF-8 \
 -v $NUGET_PATH:/root/.nuget \
@@ -31,12 +32,13 @@ cd /root/code
 for file in \$(grep -a '<pack>nuget</pack>' . -rl --include *.csproj)
 do
 	echo pack \$file
+	mkdir -p /root/code/$nugetPath
 	cd /root/code
 	cd \$(dirname \"\$file\")
 	dotnet build --configuration Release
 	dotnet pack --configuration Release --output '/root/code/$nugetPath'
 done
-" 
+"
 
 
  

+ 93 - 0
Publish/DevOps3/build-bash/40.Station-publish.sh

@@ -0,0 +1,93 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+export NUGET_PATH=$basePath/Publish/release/.nuget
+
+# "
+
+if [ ! $NUGET_PATH ]; then NUGET_PATH=$basePath/Publish/release/.nuget; fi
+
+
+#----------------------------------------------
+echo "#40.Station-publish.sh -> find projects and build"
+
+export devOpsPath="$PWD/.."
+
+docker run -i --rm \
+--env LANG=C.UTF-8 \
+-v $NUGET_PATH:/root/.nuget \
+-v "$basePath":/root/code \
+-v "$basePath":"$basePath" \
+serset/dotnet:sdk-6.0 \
+bash -c "
+set -e
+
+if grep '<publish>' -r --include *.csproj /root/code; then
+	echo '#40.Station-publish.sh -> got projects need to be built'
+else
+	echo '#40.Station-publish.sh -> skip for no project needs to be built'
+	exit 0
+fi
+
+echo '#1 get netVersion'
+export netVersion=\$(grep '<TargetFramework>' \$(grep '<publish>' -rl --include *.csproj /root/code | head -n 1) | grep -oP '>(.*)<' | tr -d '<>')
+echo netVersion: \$netVersion
+
+
+export basePath=/root/code
+export publishPath=\$basePath/Publish/release/release/Station\(\$netVersion\)
+mkdir -p \$publishPath
+
+echo '#2 publish station'
+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\"
+
+	#copy xml
+	for filePath in bin/Release/\$netVersion/*.xml ; do \\cp -rf \$filePath \"\$publishPath/\$publishName\";done
+done
+
+
+#3 copy station release files
+if [ -d \"\$basePath/Publish/ReleaseFile/Station\" ]; then
+	echo '#3 copy station release files'
+	\cp -rf \$basePath/Publish/ReleaseFile/Station/. \"\$publishPath\"
+fi
+
+
+#4 copy extra release files
+bashFile=\"$devOpsPath/environment/build-bash__40.Station-publish__#4_copyExtraReleaseFiles.sh\"
+if [ -f \"\$bashFile\" ]; then
+	echo '#4 copy extra release files'
+	sh \"\$bashFile\"
+fi
+
+
+
+
+"
+
+
+
+echo '#40.Station-publish.sh -> success!'
+
+
+
+
+

+ 23 - 0
Publish/DevOps3/build-bash/41.extra-publish.sh

@@ -0,0 +1,23 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+export NUGET_PATH=$basePath/Publish/release/.nuget
+
+# "
+
+
+#---------------------------------------------------------------------
+#41.extra-publish.sh
+bashFile="$PWD/../environment/build-bash__41.extra-publish.sh"
+if [ -f "$bashFile" ]; then
+	echo '#41.extra-publish.sh'
+	sh "$bashFile"
+fi
+
+
+

+ 46 - 0
Publish/DevOps3/build-bash/50.docker-image-copy.sh

@@ -0,0 +1,46 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+# "
+
+ 
+#---------------------------------------------------------------------
+#1 copy docker image from ReleaseFile
+
+publishPath="$basePath/Publish/release/release/Station(net6.0)"
+dockerPath=$basePath/Publish/release/release/docker-image
+
+
+if [ -d "$basePath/Publish/ReleaseFile/docker-image" ]; then
+	echo "50.docker-image-copy.sh -> #1 copy docker image from ReleaseFile"
+	\cp -rf "$basePath/Publish/ReleaseFile/docker-image/." "$dockerPath"
+fi
+
+
+
+
+#---------------------------------------------------------------------
+echo "50.docker-image-copy.sh -> #2 copy station"
+for file in $(find $basePath -name *.csproj -exec grep '<docker>' -l {} \;)
+do
+	cd $basePath
+	
+	publishName=`grep '<publish>' $file -r | grep -oE '\>(.*)\<' | tr -d '<>/'`
+	
+	dockerName=`grep '<docker>' $file -r | grep -oE '\>(.*)\<' | tr -d '<>/'`
+
+	echo "#2.* copy $dockerName, publishName:$publishName"
+	\cp -rf "$publishPath/$publishName/." "$dockerPath/$dockerName/app"
+done
+
+
+
+
+
+

+ 8 - 7
Publish/DevOps/build-bash/51.docker-deploy-copy.sh → Publish/DevOps3/build-bash/51.docker-deploy-copy.sh

@@ -2,7 +2,7 @@ set -e
 
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export basePath=/root/temp/svn
@@ -11,16 +11,17 @@ export basePath=/root/temp/svn
 
  
 #---------------------------------------------------------------------
-#(x.2)
+#2
 publishPath="$basePath/Publish/release/release/Station(net6.0)"
-deployPath=$basePath/Publish/release/release/docker-deploy
+deployPath="$basePath/Publish/release/release/docker-deploy"
 
 
 
 #----------------------------------------------
-echo "(x.3)copy dir"
-\cp -rf "$basePath/Publish/ReleaseFile/docker-deploy/." "$deployPath"
+#3 copy dir
+if [ -d "$basePath/Publish/ReleaseFile/docker-deploy" ]; then
+	echo "51.docker-deploy-copy.sh -> copy dir"
+	\cp -rf "$basePath/Publish/ReleaseFile/docker-deploy/." "$deployPath"
+fi
 
 
-
- 

+ 23 - 0
Publish/DevOps3/build-bash/52.docker-extra-copy.sh

@@ -0,0 +1,23 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+export NUGET_PATH=$basePath/Publish/release/.nuget
+
+# "
+
+
+#---------------------------------------------------------------------
+#52.docker-extra-copy.sh
+bashFile="$PWD/../environment/build-bash__52.docker-extra-copy.sh"
+if [ -f "$bashFile" ]; then
+	echo '#52.docker-extra-copy.sh'
+	sh "$bashFile"
+fi
+
+
+

+ 32 - 0
Publish/DevOps3/build-bash/startup.bash

@@ -0,0 +1,32 @@
+set -e
+
+# cd build-bash; bash startup.bash;
+
+#----------------------------------------------
+# cur path
+curPath=$PWD
+
+cd $curPath/../../..
+export basePath="$PWD"
+cd $curPath
+
+
+
+
+
+#----------------------------------------------
+echo "build-bash/startup.bash"
+
+for file in *.sh
+do
+    echo "-----------------------------------------------------------------"
+    echo "[$(date "+%H:%M:%S")] sh $file"
+    sh $file
+done
+
+
+
+ 
+#----------------------------------------------
+#
+cd $curPath

+ 4 - 4
Publish/DevOps/build-cmd/30.nuget-pack.bat → Publish/DevOps3/build-cmd/30.nuget-pack.bat

@@ -1,23 +1,23 @@
 @echo off
 
-::(x.1)获取basePath
+::1 get basePath
 set curPath=%cd%
 cd /d "%~dp0"
 cd /d ../../..
 set basePath=%cd%
 set nugetPath=%basePath%/Publish/release/release/nuget
 
-::(x.2)查找所有需要发布nuget的项目并发布
+::2 find nuget projects and pack
 for /f "delims=" %%f in ('findstr /M /s /i "<pack>nuget</pack>" *.csproj') do (
 	echo pack %basePath%\%%f\..
 	cd /d "%basePath%\%%f\.."
 	dotnet build --configuration Release
 	dotnet pack --configuration Release --output "%nugetPath%"
-	@if errorlevel 1 (echo . & echo .  & echo 出错,请排查!& pause) 
+	@if errorlevel 1 (echo . & echo .  & echo error & pause) 
 )
 
 
-echo %~n0.bat 执行成功!
+echo %~n0.bat success
 
 
 cd /d "%curPath%"

+ 31 - 0
Publish/DevOps3/build-cmd/40.Station-publish(net5.0).bat

@@ -0,0 +1,31 @@
+@echo off
+
+
+:: #1 init
+set netVersion=net5.0
+
+
+:: #2 change netcore version
+VsTool.exe replace -r --path "../../.." --file "App.Gateway.csproj|App.Gover.Gateway.csproj|App.ServiceCenter.csproj|Did.SersLoader.Demo.csproj|App.Robot.Station.csproj" --old "<TargetFramework>net6.0</TargetFramework>" --new "<TargetFramework>%netVersion%</TargetFramework>"
+
+
+
+
+
+:: #3 publish
+call "40.Station-publish.bat"
+
+
+
+
+
+
+:: #4 revert netcore version
+VsTool.exe replace -r --path "../../.." --file "App.Gateway.csproj|App.Gover.Gateway.csproj|App.ServiceCenter.csproj|Did.SersLoader.Demo.csproj|App.Robot.Station.csproj" --old "<TargetFramework>%netVersion%</TargetFramework>" --new "<TargetFramework>net6.0</TargetFramework>"
+
+
+
+
+
+echo %~n0.bat success
+cd /d "%curPath%"

+ 31 - 0
Publish/DevOps3/build-cmd/40.Station-publish(netcoreapp2.1).bat

@@ -0,0 +1,31 @@
+@echo off
+
+
+:: #1 init
+set netVersion=netcoreapp2.1
+
+
+:: #2 change netcore version
+VsTool.exe replace -r --path "../../.." --file "App.Gateway.csproj|App.Gover.Gateway.csproj|App.ServiceCenter.csproj|Did.SersLoader.Demo.csproj|App.Robot.Station.csproj" --old "<TargetFramework>net6.0</TargetFramework>" --new "<TargetFramework>%netVersion%</TargetFramework>"
+
+
+
+
+
+:: #3 publish
+call "40.Station-publish.bat"
+
+
+
+
+
+
+:: #4 revert netcore version
+VsTool.exe replace -r --path "../../.." --file "App.Gateway.csproj|App.Gover.Gateway.csproj|App.ServiceCenter.csproj|Did.SersLoader.Demo.csproj|App.Robot.Station.csproj" --old "<TargetFramework>%netVersion%</TargetFramework>" --new "<TargetFramework>net6.0</TargetFramework>"
+
+
+
+
+
+echo %~n0.bat success
+cd /d "%curPath%"

+ 57 - 0
Publish/DevOps3/build-cmd/40.Station-publish.bat

@@ -0,0 +1,57 @@
+@echo off
+
+::enable delayed arguments
+setlocal EnableDelayedExpansion
+
+
+:: #1 get basePath
+set curPath=%cd%
+cd /d "%~dp0"
+cd /d ../../..
+set basePath=%cd%
+
+
+:: #2 get netVersion
+set netVersion=net6.0
+for /f "tokens=3 delims=><" %%a in ('type %basePath%\dotnet\ServiceCenter\App.ServiceCenter\App.ServiceCenter.csproj^|findstr "<TargetFramework>.*TargetFramework"') do set netVersion=%%a
+
+
+set publishPath=%basePath%/Publish/release/release/Station(%netVersion%)
+echo publish Station
+echo dotnet version: %netVersion%
+
+
+
+:: #3 find projects and publish
+for /f "delims=" %%f in ('findstr /M /s /i "<publish>" *.csproj') do (
+	::get name
+	for /f "tokens=3 delims=><" %%a in ('type "%basePath%\%%f"^|findstr "<publish>.*publish"') do set name=%%a
+	echo publish !name!
+
+	::publish
+	cd /d "%basePath%\%%f\.."
+	dotnet build --configuration Release
+	dotnet publish --configuration Release --output "%publishPath%\!name!"
+	@if errorlevel 1 (echo . & echo .  & echo error & pause) 
+
+	::copy xml
+	xcopy  "bin\Release\%netVersion%\*.xml" "%publishPath%\!name!" /i /r /y
+)
+
+
+
+:: #4 copy dir
+xcopy "%basePath%\Publish\ReleaseFile\Station" "%publishPath%" /e /i /r /y
+
+
+
+:: #5 copy ServiceCenter
+xcopy "%publishPath%\ServiceCenter" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)\ServiceCenter" /e /i /r /y
+xcopy "%publishPath%\01.ServiceCenter.bat" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)"
+xcopy "%publishPath%\01.Start-4580.bat" "%basePath%\Publish\release\release\ServiceCenter(%netVersion%)"
+
+
+
+
+echo %~n0.bat success
+cd /d "%curPath%"

+ 97 - 0
Publish/DevOps3/build-cmd/41.StressTest-publish.bat

@@ -0,0 +1,97 @@
+@echo off
+
+::enable delayed arguments
+setlocal EnableDelayedExpansion
+
+
+
+:: #1 get 获取basePath
+set curPath=%cd%
+cd /d "%~dp0"
+cd /d ../../..
+set basePath=%cd%
+
+
+
+:: #2
+set publishPath=%basePath%/Publish/release/release/StressTest
+
+
+
+
+
+echo ------------------------------------------------------------------
+echo "#3 publish CL stressTest"
+
+::Client
+cd /d "%basePath%\dotnet\Library\Sers\Sers.CL\Test\CommunicationManage\CmClient"
+dotnet build --configuration Release
+dotnet publish --configuration Release --output "%publishPath%\CL压测net6.0\CmClient"
+@if errorlevel 1 (echo . & echo .  & echo error & pause) 
+
+::Server
+cd /d "%basePath%\dotnet\Library\Sers\Sers.CL\Test\CommunicationManage\CmServer"
+dotnet build --configuration Release
+dotnet publish --configuration Release --output "%publishPath%\CL压测net6.0\CmServer"
+@if errorlevel 1 (echo . & echo .  & echo error & pause) 
+
+
+::copy bat
+xcopy  "%basePath%\Publish\ReleaseFile\StressTest\CL压测" "%publishPath%\CL压测net6.0" /e /i /r /y
+
+
+
+
+echo ------------------------------------------------------------------
+:: #4 publish Sers stressTest
+for %%i in (net6.0) do (  
+	set netVersion=%%i
+	set appPath=%basePath%/Publish/release/release/Station^(!netVersion!^)
+
+	echo 发布 压测-!netVersion!
+
+	::单体压测
+	set targetPath=%publishPath%/单体压测!netVersion!
+
+	::(x.x.1)copy ServiceCenter
+	xcopy "!appPath!\ServiceCenter" "!targetPath!\ServiceCenter" /e /i /r /y
+
+	::(x.x.2)copy demo
+	xcopy "!appPath!\Demo\wwwroot" "!targetPath!\ServiceCenter\wwwroot" /e /i /r /y
+	xcopy "!appPath!\Demo\Did.SersLoader.Demo.dll" "!targetPath!\ServiceCenter" /i /r /y
+	xcopy "!appPath!\Demo\Did.SersLoader.Demo.pdb" "!targetPath!\ServiceCenter" /i /r /y
+	xcopy "!appPath!\Demo\Did.SersLoader.Demo.xml" "!targetPath!\ServiceCenter" /i /r /y
+
+	::(x.x.3)copy Robot
+	xcopy "!appPath!\Robot\wwwroot" "!targetPath!\ServiceCenter\wwwroot" /e /i /r /y
+	xcopy "!appPath!\Robot\App.Robot.Station.dll" "!targetPath!\ServiceCenter" /i /r /y
+	xcopy "!appPath!\Robot\App.Robot.Station.pdb" "!targetPath!\ServiceCenter" /i /r /y
+	xcopy "!appPath!\Robot\App.Robot.Station.xml" "!targetPath!\ServiceCenter" /i /r /y
+
+	::(x.x.4)copy ReleaseFile
+	xcopy "%basePath%\Publish\ReleaseFile\StressTest\单体压测" "!targetPath!" /e /i /r /y
+
+
+
+	::分布式压测
+	set targetPath=%publishPath%/分布式压测!netVersion!
+
+	::(x.x.1)copy  station
+	xcopy "!appPath!\ServiceCenter" "!targetPath!\ServiceCenter" /e /i /r /y
+	xcopy "!appPath!\Demo" "!targetPath!\Demo" /e /i /r /y
+	xcopy "!appPath!\Robot" "!targetPath!\Robot" /e /i /r /y
+
+	::(x.x.2)copy ReleaseFile
+	xcopy  "%basePath%\Publish\ReleaseFile\StressTest\分布式压测" "!targetPath!" /e /i /r /y
+)
+
+
+
+ 
+
+
+echo %~n0.bat success
+cd /d "%curPath%"
+
+
+

+ 36 - 0
Publish/DevOps3/build-cmd/50.docker-image-create.bat

@@ -0,0 +1,36 @@
+@echo off
+
+
+echo %~n0.bat start...
+
+
+:: #1 get basePath
+set curPath=%cd%
+cd /d "%~dp0"
+cd /d ../../..
+set basePath=%cd%
+
+:: #2
+set publishPath=%basePath%/Publish/release/release/Station(net6.0)
+set dockerPath=%basePath%/Publish/release/release/docker-image
+rd /s /q "%dockerPath%"
+
+
+:: #3 copy dir
+xcopy "%basePath%/Publish/ReleaseFile/docker-image" "%dockerPath%" /e /i /r /y
+
+
+:: #4 copy station 
+xcopy  "%publishPath%/ServiceCenter" "%dockerPath%/sers/app" /e /i /r /y
+xcopy  "%publishPath%/Gateway" "%dockerPath%/sers-gateway/app" /e /i /r /y
+xcopy  "%publishPath%/Gover" "%dockerPath%/sers-gover/app" /e /i /r /y
+xcopy  "%publishPath%/Demo" "%dockerPath%/sers-demo/app" /e /i /r /y
+xcopy  "%publishPath%/Robot" "%dockerPath%/sers-demo-robot/app" /e /i /r /y
+xcopy  "%basePath%/Publish/release/release/压测/单体压测net6.0/ServiceCenter" "%dockerPath%/sers-demo-sersall/app" /e /i /r /y
+ 
+
+
+
+
+echo %~n0.bat success
+cd /d "%curPath%"

+ 36 - 0
Publish/DevOps3/build-cmd/51.docker-deploy-copy.bat

@@ -0,0 +1,36 @@
+@echo off
+
+
+echo %~n0.bat start...
+
+
+::#1 get basePath
+set curPath=%cd%
+cd /d "%~dp0"
+cd /d ..\..\..
+set basePath=%cd%
+
+
+:: #2
+set publishPath=%basePath%\Publish\release\release\Station(net6.0)
+set dockerPath=%basePath%\Publish\release\release\docker-deploy
+rd /s /q "%dockerPath%"
+
+
+:: #3 copy dir
+xcopy "%basePath%\Publish\ReleaseFile\docker-deploy" "%dockerPath%" /e /i /r /y
+
+
+:: #4 copy station 
+xcopy "%publishPath%\ServiceCenter\appsettings.json" "%dockerPath%\sers"
+xcopy "%publishPath%\Gateway\appsettings.json" "%dockerPath%\sers-gateway"
+xcopy "%publishPath%\Gover\appsettings.json" "%dockerPath%\sers-gover"
+xcopy "%publishPath%\Demo\appsettings.json" "%dockerPath%\sers-demo"
+xcopy "%publishPath%\Robot\appsettings.json" "%dockerPath%\sers-demo-robot"
+xcopy "%basePath%\Publish\release\release\压测\单体压测net6.0\ServiceCenter\appsettings.json" "%dockerPath%\sers-demo-sersall"
+
+
+
+
+echo %~n0.bat success
+cd /d "%curPath%"

+ 8 - 8
Publish/DevOps/build-cmd/清理-所有.bat → Publish/DevOps3/build-cmd/Clean-All.bat

@@ -1,9 +1,9 @@
-VsTool.exe delete --path "..\..\.." --file "*.suo|*.user" --directory "obj|bin|.vs|packages"
-
-
-rd /s/q ..\..\release
-
-
-echo %~n0.bat Ö´Ðгɹ¦£¡
-
+VsTool.exe delete --path "..\..\.." --file "*.suo|*.user" --directory "obj|bin|.vs|packages"
+
+
+rd /s/q ..\..\release
+
+
+echo %~n0.bat success
+
 pause

+ 1 - 0
Publish/DevOps3/build-cmd/Clean-ReleaseFiles.bat

@@ -0,0 +1 @@
+rd /s/q ..\..\release

+ 21 - 0
Publish/DevOps3/build-cmd/OneKey Release.bat

@@ -0,0 +1,21 @@
+
+echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
+call "30.nuget-pack.bat"
+
+echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
+call "40.Station-publish.bat"
+call "40.Station-publish(netcoreapp2.1).bat"
+call "40.Station-publish(net6.0).bat"
+
+call "41.StressTest-publish.bat"
+
+echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
+call "50.docker-image-create.bat"
+call "51.docker-deploy-copy.bat"
+
+echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
+
+
+echo %~n0.bat success
+
+pause

+ 45 - 45
Publish/DevOps/build-cmd/三级版本号-改为下一temp版.bat → Publish/DevOps3/build-cmd/Version-To-NextTemp.bat

@@ -1,46 +1,46 @@
-@echo off
-
-::(x.1)get csproj
-for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
-::echo %csproj%
-
-::(x.2)get version
-for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
-
-:: set version=2.1.3
-:: echo  %version%
-
-
-::(x.3)get v1 v2 v3
-for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
-
-:: v1 v2 v3
-for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
-for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
-for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
-
-
-::(x.4)newVersion
-set /a v3=1+%v3%
-set newVersion=%v1%.%v2%.%v3%-temp
-:: echo %newVersion%
-
-
- 
-::(x.5)调用工具 替换csproj文件中的版本号
-echo 自动修改版本号 [%version%]-^>[%newVersion%]
-echo.
-
-VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
-VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
-
-
-::(x.6)调用工具 替换docker镜像命令中的版本号
-VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
-
-
-echo.
-echo.
-echo.
-echo 已经成功修改版本号 [%version%]-^>[%newVersion%]
+@echo off
+
+:: #1 get csproj
+for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
+::echo %csproj%
+
+:: #2 get version
+for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
+
+:: set version=2.1.3
+:: echo  %version%
+
+
+:: #3 get v1 v2 v3
+for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
+
+:: v1 v2 v3
+for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
+for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
+for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
+
+
+:: #4 newVersion
+set /a v3=1+%v3%
+set newVersion=%v1%.%v2%.%v3%-temp
+:: echo %newVersion%
+
+
+ 
+:: #5 replace version in csproj
+echo replace verion [%version%]-^>[%newVersion%]
+echo.
+
+VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
+VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
+
+
+:: #6 replace version in docker image file
+VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
+
+
+echo.
+echo.
+echo.
+echo replace version success [%version%]-^>[%newVersion%]
 pause

+ 45 - 45
Publish/DevOps/build-cmd/三级版本号-改为preview版.bat → Publish/DevOps3/build-cmd/Version-To-Preview.bat

@@ -1,46 +1,46 @@
-@echo off
-
-::(x.1)get csproj
-for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
-::echo %csproj%
-
-::(x.2)get version
-for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
-
-:: set version=2.1.3
-:: echo  %version%
-
-
-::(x.3)get v1 v2 v3
-for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
-
-:: v1 v2 v3
-for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
-for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
-for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
-
-
-::(x.4)newVersion
-:: set /a v3=1+%v3%
-set newVersion=%v1%.%v2%.%v3%-preview
-:: echo %newVersion%
-
-
- 
-::(x.5)调用工具 替换csproj文件中的版本号
-echo 自动修改版本号 [%version%]-^>[%newVersion%]
-echo.
-
-VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
-VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
-
-
-::(x.6)调用工具 替换docker镜像命令中的版本号
-VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
-
-
-echo.
-echo.
-echo.
-echo 已经成功修改版本号 [%version%]-^>[%newVersion%]
+@echo off
+
+:: #1 get csproj
+for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
+::echo %csproj%
+
+:: #2 get version
+for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
+
+:: set version=2.1.3
+:: echo  %version%
+
+
+:: #3 get v1 v2 v3
+for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
+
+:: v1 v2 v3
+for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
+for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
+for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
+
+
+:: #4 newVersion
+:: set /a v3=1+%v3%
+set newVersion=%v1%.%v2%.%v3%-preview
+:: echo %newVersion%
+
+
+ 
+:: #5 replace version in csproj
+echo 自动修改版本号 [%version%]-^>[%newVersion%]
+echo.
+
+VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
+VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
+
+
+:: #6 replace version in docker image file
+VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
+
+
+echo.
+echo.
+echo.
+echo replace version success [%version%]-^>[%newVersion%]
 pause

+ 42 - 42
Publish/DevOps/build-cmd/三级版本号-改为release版.bat → Publish/DevOps3/build-cmd/Version-To-Release.bat

@@ -1,43 +1,43 @@
-@echo off
-
-::(x.1)get csproj
-for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
-::echo %csproj%
-
-::(x.2)get version
-for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
-
-:: set version=2.1.3
-:: echo  %version%
-
-
-::(x.3)get v1 v2 v3
-for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
-
-:: v1 v2 v3
-for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
-for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
-for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
-
-
-::(x.4)newVersion
-:: set /a v3=1+%v3%
-set newVersion=%v1%.%v2%.%v3%
-:: echo %newVersion%
-echo [%version%]-^>[%newVersion%]
-
- 
-::(x.5)调用工具 替换csproj文件中的版本号
-VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
-VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
-
-
-::(x.6)调用工具 替换docker镜像命令中的版本号
-VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
-
-
-echo.
-echo.
-echo.
-echo 已经成功修改版本号 [%version%]-^>[%newVersion%]
+@echo off
+
+:: #1 get csproj
+for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
+::echo %csproj%
+
+:: #2 get version
+for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
+
+:: set version=2.1.3
+:: echo  %version%
+
+
+:: #3 get v1 v2 v3
+for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
+
+:: v1 v2 v3
+for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
+for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
+for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
+
+
+:: #4 newVersion
+:: set /a v3=1+%v3%
+set newVersion=%v1%.%v2%.%v3%
+:: echo %newVersion%
+echo [%version%]-^>[%newVersion%]
+
+ 
+:: #5 replace version in csproj
+VsTool.exe replace -r --path "..\..\.." --file "*.csproj" --old "<Version>%version%</Version>" --new "<Version>%newVersion%</Version>"
+VsTool.exe replace -r --path "..\..\.." --file "packages.config" --old "%version%" --new "%newVersion%"
+
+
+:: #6 replace version in docker image file
+VsTool.exe replace -r --path "..\..\..\Publish\ReleaseFile\docker-image" --file "*.md" --old "%version%" --new "%newVersion%"
+
+
+echo.
+echo.
+echo.
+echo replace version success [%version%]-^>[%newVersion%]
 pause

+ 32 - 0
Publish/DevOps3/build-cmd/Version-getVersion.bat

@@ -0,0 +1,32 @@
+@echo off
+
+:: get current version
+
+
+:: #1 get csproj
+for /f "delims=" %%a in ('findstr /M /s /i /r "<pack> <publish>" "..\..\..\*.csproj"') do set "csproj=%%~a"
+echo %csproj%
+
+:: #2 get version
+for /f "tokens=3 delims=><" %%a in ('type %csproj%^|findstr "<Version>.*Version"') do set version=%%a
+
+:: set version=2.1.3
+:: echo  %version%
+
+
+:: #3 get v1 v2 v3
+for /f "tokens=1 delims=-" %%i in ("%version%") do set numVersion=%%i
+
+:: v1 v2 v3
+for /f "tokens=1 delims=." %%i in ("%numVersion%") do set v1=%%i
+for /f "tokens=2 delims=." %%i in ("%numVersion%") do set v2=%%i
+for /f "tokens=3 delims=." %%i in ("%numVersion%") do set v3=%%i
+
+
+:: #4 newVersion
+::set /a v3=1+%v3%
+set  newVersion=%v1%.%v2%.%v3%-preview
+echo [%version%]-^>[%newVersion%]
+
+
+pause

+ 0 - 0
Publish/DevOps/build-cmd/VsTool.exe → Publish/DevOps3/build-cmd/VsTool.exe


+ 1 - 0
Publish/DevOps3/environment/env.APPNAME.txt

@@ -0,0 +1 @@
+ServiceAdaptor.NetCore

+ 1 - 0
Publish/DevOps3/environment/env.envName.txt

@@ -0,0 +1 @@
+ki

+ 13 - 0
Publish/DevOps3/environment/readme.md

@@ -0,0 +1,13 @@
+
+# DevOps 3.1
+> 2024-04-27
+
+# build-bash
+extra steps when building, all sh files could be remove if not needed.
+
+
+
+
+
+
+

+ 30 - 0
Publish/DevOps3/github-bash/74.github-push-to-webdav.sh

@@ -0,0 +1,30 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+export APPNAME=xxxx
+export appVersion=xxxx
+
+export WebDav_BaseUrl="https://nextcloud.xxx.com/remote.php/dav/files/release/releaseFiles/ki_jenkins"
+export WebDav_User="username:pwd"
+
+# "
+
+
+
+
+
+#----------------------------------------------
+if [ -z "$WebDav_BaseUrl" ]; then
+	echo "github skip pushing release file to WebDav because invalid WebDav endpoint"
+else
+	echo "github push release file to WebDav"
+	bash "$PWD/../release-bash/78.push-releaseFiles-to-webdav.bash";
+fi
+
+

+ 12 - 11
Publish/DevOps/github-bash/76.github-push-release.sh → Publish/DevOps3/github-bash/76.github-push-release.sh

@@ -2,12 +2,12 @@ set -e
 
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export basePath=/root/temp/svn
 
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
+export appVersion=1.0-preview
 
 export APPNAME=xxxxxx
 
@@ -18,37 +18,38 @@ export APPNAME=xxxxxx
 
 
 #---------------------------------------------------------------------
-#(x.2)构建github release环境变量
+#2 init environment for github release
 
 
 
+echo "appName=${APPNAME}" >> $GITHUB_ENV
 
-echo "release_name=${APPNAME}-${version}" >> $GITHUB_ENV
-echo "release_tag=${version}" >> $GITHUB_ENV
+echo "release_name=${APPNAME}-${appVersion}" >> $GITHUB_ENV
+echo "release_tag=${appVersion}" >> $GITHUB_ENV
 
 echo "release_draft=false" >> $GITHUB_ENV
 echo "release_prerelease=false" >> $GITHUB_ENV
 
-echo "release_body=" >> $GITHUB_ENV
+echo "release_body=${APPNAME} ${appVersion}" >> $GITHUB_ENV
 
 
 echo "release_dirPath=${basePath}/Publish/release/release-zip" >> $GITHUB_ENV
-echo "release_version=${version}" >> $GITHUB_ENV
+echo "release_version=${appVersion}" >> $GITHUB_ENV
 
-#filePath=$basePath/Publish/release/release-zip/Sers-ServiceCenter(net5.0)-${version}.zip
+#filePath=$basePath/Publish/release/release-zip/Sers-ServiceCenter(net6.0)-${appVersion}.zip
 #fileType="${filePath##*.}"
 #echo "release_assetPath=${filePath}" >> $GITHUB_ENV
-#echo "release_assetName=${APPNAME}-${version}.${fileType}" >> $GITHUB_ENV
+#echo "release_assetName=${APPNAME}-${appVersion}.${fileType}" >> $GITHUB_ENV
 #echo "release_contentType=application/zip" >> $GITHUB_ENV
 
 
 # draft or preivew
-if [[ $version =~ "preview" ]]
+if [ "preview" = "$(echo $appVersion | tr -d \"0-9\-\\.\")" ]
 then
   echo preivew
   echo "release_prerelease=true" >> $GITHUB_ENV
 else
-  if  [[ "" = $(echo $version | tr -d "0-9\.") ]]
+  if  [ "" = "$(echo $appVersion | tr -d \"0-9\-\\.\")" ]
   then
     echo release
   else

+ 70 - 0
Publish/DevOps3/github-bash/startup.bash

@@ -0,0 +1,70 @@
+set -e
+
+# cd github-bash; bash startup.bash;
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+#export APPNAME=xxxxxx
+
+export DOCKER_USERNAME=serset
+export DOCKER_PASSWORD=xxxxxx
+
+export NUGET_SERVER=https://api.nuget.org/v3/index.json
+export NUGET_KEY=xxxxxx
+
+export WebDav_BaseUrl="https://nextcloud.xxx.com/remote.php/dav/files/release/releaseFiles/ki_jenkins"
+export WebDav_User="username:pwd"
+
+# "
+
+#----------------------------------------------
+# cur path
+curPath=$PWD
+
+cd $curPath/../../..
+export basePath="$PWD"
+cd $curPath
+
+export devOpsPath="$PWD/.."
+
+# export basePath=/root/temp/svn
+
+if [ ! $APPNAME ]; then 
+	export APPNAME=$(cat "$devOpsPath/environment/env.APPNAME.txt" | tr -d '\n')
+	echo "APPNAME: [${APPNAME}]" 
+fi
+
+#---------------------------------------------- 
+echo '#1 build'
+cd "$devOpsPath/build-bash"; bash startup.bash;
+
+#---------------------------------------------- 
+echo '#2 release-bash'
+cd "$devOpsPath/release-bash"; bash startup.bash;
+ 
+
+
+#----------------------------------------------
+echo "#3 get appVersion" 
+cd "$devOpsPath/build-bash"; source 19.get-app-version.bash;
+
+
+
+#----------------------------------------------
+echo "#4 bash"
+cd $curPath
+for file in *.sh
+do
+    echo "-----------------------------------------------------------------"
+    echo "[$(date "+%H:%M:%S")]" sh $file
+    sh $file
+done
+
+
+
+
+
+
+

+ 168 - 0
Publish/DevOps3/jenkins-bash/CICD.ki.git_Multibranch.deploy.jenkinsfile

@@ -0,0 +1,168 @@
+def remote = [:]
+remote.name = "dind-ssh"
+remote.host = "dind"
+remote.port = 22
+remote.user = "  "
+remote.password = "  "
+remote.allowAnyHosts = true
+
+pipeline {
+    agent any
+
+    environment {
+        // get APPNAME
+        // APPNAME = "Sers"
+        APPNAME = readFile("Publish/DevOps3/environment/env.APPNAME.txt")
+
+        envName = readFile("Publish/DevOps3/environment/env.envName.txt")
+        versionSuffix = "-${envName}${env.build_number}"
+
+        //basePath = "/root/docker-cache/jenkins/jenkins_home/workspace/${APPNAME}/${envName}/${env.BRANCH_NAME}/${env.build_number}"
+        basePath = "${env.WORKSPACE}"
+
+        NUGET_PATH = "/root/docker-cache/jenkins/jenkins_home/workspace/.nuget"
+
+        NUGET_SERVER = "http://nuget.lith.cloud:8"
+        //NUGET_KEY = " "
+        NUGET_KEY = credentials("nuget_key")
+
+        DOCKER_ImagePrefix = "docker.lith.cloud:8/${envName}/"
+        DOCKER_Buildx = false
+        DOCKER_USERNAME = " "
+        DOCKER_PASSWORD = " "
+
+        // set to "  "  if want to skip save releaseFiles to WebDav
+        WebDav_BaseUrl = "https://pan.lith.cloud:4/remote.php/dav/files/release/releaseFiles/ki_jenkins"
+        // "username:pwd"
+        WebDav_User = credentials("WebDav_User")
+
+        build_crossPlatform = "no"
+
+        dind_ssh_account = credentials("dind_ssh_account")
+    }
+
+    stages {
+        stage('#1 deploy ?') {
+            steps {
+                timeout(time:600,unit:'SECONDS') {
+                    script {
+                        remote.user = "${dind_ssh_account_USR}"
+                        remote.password = "${dind_ssh_account_PSW}"
+
+                        env.codePath = "/root/docker-cache/jenkins/" + basePath.substring(5, basePath.length()) 
+
+                        echo "-------- APPNAME: [$APPNAME]"
+                        echo "-------- basePath: [$basePath]"
+                        echo "-------- DOCKER_ImagePrefix: [$DOCKER_ImagePrefix]"
+                        echo "-------- codePath: [$codePath]"
+
+                        env.inputChoice = "no"
+                        env.inputChoice = input message: "deploy ?", 
+                            ok: 'Proceed?', 
+                            parameters: [choice(choices:["yes","no"], description: 'if not please select no', name: 'choice')]
+                    }
+                }
+            }
+        }
+
+        stage('#2 change version') {
+            when { expression { env.inputChoice == "yes" } }
+            steps {
+                script {
+                    echo "#2.1 change-app-version"
+                    sshCommand remote: remote, command:  "sh -c 'set -e; export versionSuffix=$versionSuffix;    cd $codePath/Publish/DevOps3/build-bash; source 22.add-suffix-to-app-version.bash;    echo -n \"\$nextAppVersion\" > $codePath/Publish/DevOps3/environment/env.appVersion.txt '"
+
+                    echo "#2.2 get app version"
+                    env.appVersion = readFile("Publish/DevOps3/environment/env.appVersion.txt")
+                    echo "-------- appVersion: [${env.appVersion}]"
+                }
+            }
+        }
+
+        stage('#3.1 build - single platflorm') {
+            when { expression { env.inputChoice == "yes" } }
+            steps {
+                script {
+                    sshCommand remote: remote, command:  "sh -c 'set -e; export APPNAME=$APPNAME; export NUGET_PATH=$NUGET_PATH;    cd $codePath/Publish/DevOps3/build-bash; sh startup.bash;  '"
+                }
+            }
+        }
+
+        stage('#3.2 build - cross platform') {
+            when { expression { env.inputChoice == "yes" && env.build_crossPlatform == "yes" } }
+            steps {
+                script {
+                    sshCommand remote: remote, command:  "sh -c 'set -e; export APPNAME=$APPNAME; export NUGET_PATH=$NUGET_PATH;    cd $codePath/Publish/DevOps3/build-bash; sh 40.Station-publish-multiple.bash;  '"
+                }
+            }
+        }
+
+        stage('#4 publish') {
+            when { expression { env.inputChoice == "yes" } }
+            steps {
+                script {
+                    sshCommand remote: remote, command:  "sh -c 'set -e; export APPNAME=$APPNAME;export NUGET_PATH=$NUGET_PATH;    export NUGET_SERVER=$NUGET_SERVER;export NUGET_KEY=$NUGET_KEY;  export DOCKER_Buildx=${env.DOCKER_Buildx};export DOCKER_ImagePrefix=${env.DOCKER_ImagePrefix};export DOCKER_USERNAME=${env.DOCKER_USERNAME};export DOCKER_PASSWORD=${env.DOCKER_PASSWORD};export DOCKER_BuildxExtArgs=\"--output=type=registry,registry.insecure=true\";    cd $codePath/Publish/DevOps3/release-bash; sh startup.bash;  '"
+                }
+            }
+        }
+
+        stage('#5 save releaseFiles') {
+            when { expression { env.inputChoice == "yes" && env.WebDav_BaseUrl != "  " } }
+            steps {
+                script {
+                    sshCommand remote: remote, command:  "sh -c 'set -e; export basePath=\"$codePath\"; export APPNAME=$APPNAME; export appVersion=\"$appVersion\";   export WebDav_BaseUrl=\"$WebDav_BaseUrl\"; export WebDav_User=\"$WebDav_User\";    cd $codePath/Publish/DevOps3/release-bash; sh 78.push-releaseFiles-to-webdav.bash;  '"
+                }
+            }
+        }
+
+        stage('#6 deploy') {
+            when { expression { env.inputChoice == "yes" && env.build_deploy == "yes" } }
+            steps {
+                script {
+
+                    remote.name = "k8s-ssh"
+                    remote.host = "k8s.lith.cloud"
+
+                    remote.user = "${k8s_ssh_account_USR}"
+                    remote.password = "${k8s_ssh_account_PSW}"
+
+                    sshCommand remote: remote, command:  "sh -c 'set -e;  cd /home/DataStore/Local/Data/2000/200.flowtea-prod/helm;    helm upgrade flowtea --set appNum=200 --set debug=true --set resources.limits=false --set image.host=\"\" --set image.tag=\"${env.appVersion}\" --set storageClass.ssd=nfs-prod-ssd --set storageClass.hdd=nfs-prod-hdd ./flowtea -n flowtea;  '"
+                }
+            }
+        }
+
+    }
+
+    post {
+        always {
+            timeout(time:3600,unit:'SECONDS') {
+                script {
+                    env.inputChoice = "yes"
+                    env.inputChoice = input message: "Clean temp files, \n will wait for 3600 seconds. \n click abort to skip clean.", 
+                            ok: 'Proceed', 
+                            parameters: [choice(choices:["yes","no"], name: 'choice')]
+               }
+            }
+            script {
+                if ( inputChoice == "yes" ) {
+                    echo "clean up workspace directory"
+                    cleanWs()
+
+                    // clean up tmp directory
+                    dir("${workspace}@tmp") {
+                        deleteDir()
+                    }
+                }
+            }
+        }
+        success {
+            echo "build success !"
+        }
+        failure {
+            echo "build failure !"
+        }
+        aborted {
+            echo "build aborted !"
+        }
+    }
+}

+ 10 - 4
Publish/DevOps/release-bash/71.file-zip.sh → Publish/DevOps3/release-bash/71.file-zip.sh

@@ -2,19 +2,24 @@ set -e
 
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export basePath=/root/temp/svn
 
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
+export appVersion=1.0
 
 export APPNAME=xxxxxx
 
 # "
 
 #----------------------------------------------
-echo "压缩文件"
+echo "71.file-zip.sh"
+
+if [ ! -d "$basePath/Publish/release/release" ]; then
+    echo '71.file-zip.sh -> skip for no files exist'
+    exit 0
+fi
 
 docker run --rm -i \
 -v $basePath:/root/code \
@@ -22,12 +27,13 @@ serset/filezip bash -c "
 set -e
 
 releasePath=/root/code/Publish/release
+rm -rf \$releasePath/release-zip
 
 for dirname in \`ls /root/code/Publish/release/release\`
 do
   if [ -d \$releasePath/release/\$dirname ]
   then
-    filezip zip -p -i \$releasePath/release/\$dirname -o \$releasePath/release-zip/${APPNAME}-\${dirname}-${version}.zip 
+    filezip zip -p -i \$releasePath/release/\$dirname -o \$releasePath/release-zip/${APPNAME}-\${dirname}-${appVersion}.zip 
   fi
 done
 

+ 10 - 7
Publish/DevOps/release-bash/72.nuget-push.sh → Publish/DevOps3/release-bash/72.nuget-push.sh

@@ -3,7 +3,7 @@ set -e
 
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export basePath=/root/temp/svn
@@ -13,21 +13,24 @@ export NUGET_KEY=xxxxxxxxxx
 
 # "
 
+#----------------------------------------------
+echo "72.nuget-push.sh"
+
+if [ ! -d "$basePath/Publish/release/release/nuget" ]; then
+    echo '71.file-zip.sh -> skip for no nuget files exist'
+    exit 0
+fi
 
-nugetPath=Publish/release/release/nuget
- 
 
-#----------------------------------------------
-echo "(x.2)nuget-push"
 docker run -i --rm \
 --env LANG=C.UTF-8 \
 -v $basePath:/root/code \
 serset/dotnet:sdk-6.0 \
 bash -c "
-for file in /root/code/$nugetPath/*.nupkg
+for file in /root/code/Publish/release/release/nuget/*.nupkg
 do
     echo nuget push \$file
-    dotnet nuget push \$file -k ${NUGET_KEY} -s ${NUGET_SERVER}
+    dotnet nuget push \$file -k ${NUGET_KEY} -s ${NUGET_SERVER} --skip-duplicate
 done
 " || true
 

+ 39 - 0
Publish/DevOps3/release-bash/73.docker-image-build-push.sh

@@ -0,0 +1,39 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+export appVersion=1.0
+
+export DOCKER_ImagePrefix=serset/
+export DOCKER_USERNAME=serset
+export DOCKER_PASSWORD=xxx
+
+export DOCKER_Buildx=false #default: true
+export DOCKER_BuildxExtArgs=
+
+# "
+
+
+
+
+#---------------------------------------------------------------------
+echo "73.docker-image-build-push.sh"
+
+if [ ! -d "$basePath/Publish/release/release/docker-image" ]; then
+    echo '73.docker-image-build-push.sh -> skip for no docker image files exist'
+    exit 0
+fi
+
+if [ "$DOCKER_Buildx" != "false" ]; then
+    sh 75.docker-image-build-push_cross.bash
+else
+    sh 74.docker-image-build-push_amd64.bash
+fi
+
+
+

+ 41 - 0
Publish/DevOps3/release-bash/74.docker-image-build-push_amd64.bash

@@ -0,0 +1,41 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+export appVersion=1.0
+
+export DOCKER_ImagePrefix=serset/
+export DOCKER_USERNAME=serset
+export DOCKER_PASSWORD=xxx
+export DOCKER_BuildxExtArgs=
+
+# "
+
+
+#---------------------------------------------------------------------
+echo "74.docker-image-build-push_amd64.bash"
+
+echo "#1 login if UserName is not empty"
+if [ -n "$DOCKER_USERNAME" ]; then docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD; fi
+
+dockerPath=$basePath/Publish/release/release/docker-image
+
+for dockerName in `ls $dockerPath`
+do
+  if [ -d $dockerPath/$dockerName ]
+  then
+    echo "#2.* docker build $dockerName"
+    echo "docker build $dockerPath/$dockerName -t ${DOCKER_ImagePrefix}$dockerName:$appVersion -t ${DOCKER_ImagePrefix}$dockerName"
+    docker build $dockerPath/$dockerName -t ${DOCKER_ImagePrefix}$dockerName:$appVersion -t ${DOCKER_ImagePrefix}$dockerName
+    docker push ${DOCKER_ImagePrefix}$dockerName:$appVersion
+    docker push ${DOCKER_ImagePrefix}$dockerName
+    docker rmi -f ${DOCKER_ImagePrefix}$dockerName:$appVersion ${DOCKER_ImagePrefix}$dockerName
+  fi
+done
+
+

+ 71 - 0
Publish/DevOps3/release-bash/75.docker-image-build-push_cross.bash

@@ -0,0 +1,71 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+export appVersion=1.0
+
+export DOCKER_ImagePrefix=serset/
+export DOCKER_USERNAME=serset
+export DOCKER_PASSWORD=xxx
+export DOCKER_BuildxExtArgs=
+
+# "
+
+
+
+
+#---------------------------------------------------------------------
+echo "75.docker-image-build-push_cross.bash -> #1 docker - init buildx"
+
+
+export builderName="mybuilder__${appVersion}__"
+echo "builderName: $builderName"
+
+
+echo "#1.1 docker buildx version"
+docker buildx version
+
+echo "#1.2 install binfmt_misc"
+docker run --privileged --rm tonistiigi/binfmt --install all
+
+echo "#1.3 create builder"
+if [ ! "$(docker buildx ls | grep $builderName)" ]; then docker buildx create --use --name $builderName --buildkitd-flags '--allow-insecure-entitlement security.insecure'; fi
+
+echo "#1.4 start builder"
+docker buildx inspect $builderName --bootstrap
+
+echo "#1.5 show builders and supported CPU platform"
+docker buildx ls
+
+
+
+#---------------------------------------------------------------------
+echo "75.docker-image-build-push_cross.bash -> #2 docker - build and push"
+
+echo "#2.1 login if UserName is not empty"
+if [ -n "$DOCKER_USERNAME" ]; then docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD; fi
+
+dockerPath=$basePath/Publish/release/release/docker-image
+
+for dockerName in `ls $dockerPath`
+do
+  if [ -d $dockerPath/$dockerName ]
+  then
+    platform="linux/amd64,linux/arm64,linux/arm/v7"
+    if [ -f "$dockerPath/$dockerName/Dockerfile.platform" ]; then platform=`cat "$dockerPath/$dockerName/Dockerfile.platform"`; fi
+
+    echo "#2.* docker build $dockerName, platform: $platform"
+    echo "docker buildx build --allow security.insecure $dockerPath/$dockerName -t ${DOCKER_ImagePrefix}$dockerName:$appVersion -t ${DOCKER_ImagePrefix}$dockerName --platform=$platform --push $DOCKER_BuildxExtArgs --builder $builderName"
+    docker buildx build --allow security.insecure $dockerPath/$dockerName -t ${DOCKER_ImagePrefix}$dockerName:$appVersion -t ${DOCKER_ImagePrefix}$dockerName --platform=$platform --push $DOCKER_BuildxExtArgs --builder $builderName
+  fi
+done
+
+
+#---------------------------------------------------------------------
+echo "75.docker-image-build-push_cross.bash -> #3 remove builder"
+if [ "$(docker buildx ls | grep $builderName)" ]; then docker buildx rm $builderName; fi

+ 47 - 0
Publish/DevOps3/release-bash/78.push-releaseFiles-to-webdav.bash

@@ -0,0 +1,47 @@
+set -e
+
+
+#---------------------------------------------------------------------
+# args
+args_="
+
+export basePath=/root/temp/svn
+
+export APPNAME=Vit.Library
+export appVersion=2.2.14
+
+export WebDav_BaseUrl="https://nextcloud.xxx.com/remote.php/dav/files/release/releaseFiles/ki_jenkins"
+export WebDav_User="username:pwd"
+
+# "
+
+
+# will not throw errors if WebDav service is not available
+
+
+#---------------------------------------------------------------------
+echo "78.push-releaseFiles-to-webdav.bash -> #1 create dir"
+
+docker run -i --rm curlimages/curl sh -c "curl -X MKCOL -u \"$WebDav_User\" \"$WebDav_BaseUrl/$APPNAME\" " || true
+docker run -i --rm curlimages/curl sh -c "curl -X MKCOL -u \"$WebDav_User\" \"$WebDav_BaseUrl/$APPNAME/$appVersion\" " || true
+
+#---------------------------------------------------------------------
+echo "78.push-releaseFiles-to-webdav.bash -> #2 push release files"
+
+docker run -i --rm \
+-v "$basePath/Publish/release/release-zip":/releaseFiles \
+curlimages/curl \
+sh -c "
+cd /releaseFiles
+for file in /releaseFiles/*
+do
+    echo ''
+    echo '----------------------------'
+    fileName=\"\${file##*/}\"
+    echo push file: \$fileName
+    curl -X PUT -u \"$WebDav_User\" -T "/releaseFiles/\$fileName" \"$WebDav_BaseUrl/$APPNAME/$appVersion/\$fileName\"
+done
+" || true
+
+#---------------------------------------------------------------------
+echo "78.push-releaseFiles-to-webdav.bash -> #3 success"

+ 15 - 15
Publish/DevOps/release-bash/startup.bash → Publish/DevOps3/release-bash/startup.bash

@@ -3,11 +3,12 @@ set -e
 # cd /root/temp/svn/Publish/DevOps/release-bash;bash startup.bash;
 
 #---------------------------------------------------------------------
-#(x.1)参数
+# args
 args_="
 
 export APPNAME=xxxxxx
 
+export DOCKER_ImagePrefix=serset/
 export DOCKER_USERNAME=serset
 export DOCKER_PASSWORD=xxx
 
@@ -18,21 +19,20 @@ export NUGET_KEY=xxxxxxxxxx
 
 
 #----------------------------------------------
-#(x.2)当前路径
-curPath=$PWD
+# cur path
+curPath="$PWD"
 
-cd $curPath/../../..
-export basePath=$PWD
-cd $curPath
+cd "$curPath/../../.."
+export basePath="$PWD"
+cd "$curPath"
 
 # export basePath=/root/temp/svn
 
 
 
 #----------------------------------------------
-echo "(x.3)get version" 
-export version=`grep '<Version>' $(grep '<pack>\|<publish>' ${basePath} -r --include *.csproj -l | head -n 1) | grep -oP '>(.*)<' | tr -d '<>'`
-echo $version
+echo "#1 get appVersion"
+cd "$curPath/../build-bash"; source 19.get-app-version.bash;
 
 
 
@@ -40,17 +40,17 @@ echo $version
 
 
 #----------------------------------------------
-#(x.4)bash
-
+echo "#2 bash"
+cd $curPath
 for file in *.sh
 do
-    echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    echo "[$(date "+%H:%M:%S")]" bash $file
-    bash $file
+    echo "-----------------------------------------------------------------"
+    echo "[$(date "+%H:%M:%S")] sh $file"
+    sh "$file"
 done
 
 
-
+cd "$curPath"
 
 
 

+ 10 - 0
clean-temp.bat

@@ -0,0 +1,10 @@
+cd Publish\DevOps3\build-cmd
+VsTool.exe delete --path "..\..\.." --file "*.suo|*.user" --directory "obj|bin|.vs|packages"
+
+
+rd /s/q ..\..\release
+
+
+echo %~n0.bat success£¡
+
+pause