lith 3 tahun lalu
induk
melakukan
5b5f558172

+ 10 - 11
Publish/DevOps/github/40.dotnet-publish.sh

@@ -27,30 +27,29 @@ serset/dotnet:6.0-sdk \
 bash -c "
 set -e
 
-publishPath=/root/code/Publish/release/Sers/SersPublish/$netVersion
+basePath=/root/code
+publishPath=\$basePath/Publish/release/release/publish
 
 #(x.3)查找所有需要发布的项目并发布
-cd /root/code/dotnet
+cd \$basePath
 for file in \$(grep -a '<publish>' . -rl --include *.csproj)
 do
-	cd /root/code/dotnet
+	cd \$basePath
 	
-	#get name
-	name=\`grep '<publish>' \$file -r | grep -oP '>(.*)<' | tr -d '<>'\`
-	echo publish \$name
+	#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/\$name
-
-	#copy xml
-	for filePath in bin/Release/$netVersion/*.xml ; do \\cp -rf \$filePath \$publishPath/\$name;done
+	dotnet publish --configuration Release --output \$publishPath/\$publishName
 done
 
 
 #(x.4)copy bat
-\\cp -rf /root/code/Publish/PublishFile/SersPublish/. \$publishPath
+\\cp -rf /root/code/Publish/ReleaseFile/publish/. \$publishPath
 
 
 "

+ 50 - 0
Publish/DevOps/github/70.docker-image-create.sh

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

+ 12 - 25
Publish/DevOps/github/90.release-build.sh

@@ -5,13 +5,11 @@ set -e
 #(x.1)参数
 args_="
 
-export codePath=/root/docker/jenkins/workspace/sqler/svn 
-
-
+export codePath=/root/temp/svn
 
 export version=`grep '<Version>' ${codePath} -r --include *.csproj | grep -oP '>(.*)<' | tr -d '<>'`
 
-export name=sqler
+export name=filezip
 
 export export GIT_SSH_SECRET=xxxxxx
 
@@ -22,21 +20,12 @@ export export GIT_SSH_SECRET=xxxxxx
 
 
 #----------------------------------------------
-echo "(x.2.1)发布文件-创建文件夹及内容"
-mkdir -p $codePath/Publish/git
-mkdir -p $codePath/Publish/release
-
-cp -rf  $codePath/Publish/04.服务站点 $codePath/Publish/release/04.服务站点
-cp -rf  $codePath/Publish/06.Docker $codePath/Publish/release/06.Docker
-cp -rf  $codePath/Publish/06.Docker/制作镜像/${name}/app $codePath/Publish/release/04.服务站点/${name}
-
+echo "(x.2)发布文件-压缩"
 
-echo "(x.2.3)发布文件-压缩" 
 docker run --rm -i \
--v $codePath/Publish:/root/file \
-serset/filezip dotnet FileZip.dll zip -i /root/file/release -o /root/file/git/${name}-${version}.zip
+-v $codePath:/root/code \
+serset/filezip dotnet FileZip.dll zip -p -i /root/code/Publish/release/release -o /root/code/Publish/release/${name}-${version}.zip 
 
- 
 
 
 
@@ -45,17 +34,18 @@ serset/filezip dotnet FileZip.dll zip -i /root/file/release -o /root/file/git/${
 
 #----------------------------------------------
 echo "(x.3)github-提交release文件到release仓库"
-# releaseFile=$codePath/Publish/git/${name}-${version}.zip
+# releaseFile=$codePath/Publish/release/${name}-${version}.zip
 
 #复制ssh key
-echo "${GIT_SSH_SECRET}" > $codePath/Publish/git/serset
-chmod 600 $codePath/Publish/git/serset
+echo "${GIT_SSH_SECRET}" > $codePath/Publish/release/serset
+chmod 600 $codePath/Publish/release/serset
 
 #推送到github
-docker run -i --rm -v $codePath/Publish/git:/root/git serset/git-client bash -c " \
+docker run -i --rm \
+-v $codePath/Publish/release:/root/release serset/git-client bash -c "
 set -e
 ssh-agent bash -c \"
-ssh-add /root/git/serset
+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'
@@ -63,14 +53,11 @@ mkdir -p /root/code
 cd /root/code
 git clone git@github.com:serset/release.git /root/code
 mkdir -p /root/code/file/${name}
-cp /root/git/${name}-${version}.zip /root/code/file/${name}
+cp /root/release/${name}-${version}.zip /root/code/file/${name}
 git add file/${name}/${name}-${version}.zip
 git commit -m 'auto commit ${version}'
 git push -u origin master \" "
 
 
-
-
-
  
  

+ 18 - 8
Publish/DevOps/github/91.release-github.sh

@@ -5,13 +5,11 @@ set -e
 #(x.1)参数
 args_="
 
-export codePath=/root/docker/jenkins/workspace/sqler/svn 
-
-
+export codePath=/root/temp/svn
 
 export version=`grep '<Version>' ${codePath} -r --include *.csproj | grep -oP '>(.*)<' | tr -d '<>'`
 
-export name=sqler
+export name=filezip
 
 # "
 
@@ -21,14 +19,13 @@ export name=sqler
 
 #---------------------------------------------------------------------
 #(x.2)初始化github release环境变量
-# releaseFile=$codePath/Publish/git/${name}-${version}.zip
+releaseFile=$codePath/Publish/release/${name}-${version}.zip
 
-filePath="$codePath/Publish/git/${name}-${version}.zip"
+filePath=${releaseFile}
 #name=Vit.Library
 #version=2.5
 
 
-
 fileType="${filePath##*.}"
 echo "release_name=${name}-${version}" >> $GITHUB_ENV
 echo "release_tag=${version}" >> $GITHUB_ENV
@@ -44,5 +41,18 @@ echo "release_contentType=application/${fileType}" >> $GITHUB_ENV
 
 
 
+# draft or preivew
+if [[ $version =~ "preview" ]]
+then
+  echo preivew
+  echo "release_prerelease=true" >> $GITHUB_ENV
+else
+  if  [[ "" = $(echo $version | tr -d "0-9\.") ]]
+  then
+    echo release
+  else
+    echo draft
+    echo "release_draft=true" >> $GITHUB_ENV
+  fi
+fi
 
- 

+ 1 - 1
Publish/cmd/docker-image-create.bat

@@ -18,7 +18,7 @@ set dockerPath=%basePath%/Publish/release/release/docker-image
 
 rd /s /q "%dockerPath%"
 
-::(x.2)copy bat
+::(x.2)copy dir
 xcopy "%basePath%/Publish/ReleaseFile/docker-image" "%dockerPath%" /e /i /r /y
 
 

+ 1 - 0
Publish/cmd/dotnet-publish.bat

@@ -21,6 +21,7 @@ set publishPath=%basePath%/Publish/release/release/publish
 for /f "delims=" %%f in ('findstr /M /s /i "<publish>" *.csproj') do (
 	::get publishName
 	for /f "tokens=3 delims=><" %%a in ('type "%basePath%\%%f"^|findstr "<publish>.*publish"') do set publishName=%%a
+
 	echo publish !publishName!
 
 	::publish