My ASP.NET MVC web app is written using C# and uses SQL Server stored procedures.
I am using Git for code source control, and each time I deploy, I will create a tag to define the version deployed.
Example: tag1_2021_07_29_11_00
, tag2_2021_07_30_09_01
... and the tag will be time I deploy, this time deploy can random.
And the stored procedure I need to run is list file between two tag:
tag2_2021_07_30_09_01
and tag1_2021_07_29_11_00
.
(Example sp1.sql
, sp2.sql
, sp3.sql
I will run it in SQL Server Management Studio)
I want to automate the deployment with cmd for saving time.
I created successfully cmd command to build and export deployment web source code, but i don't know the command to export my .sql
file between tag1
and tag2
into one folder.
Do note that I see that TortoiseGit has a function "export this version..
" when I show git log
and choose my list SQL stored procedure file sp1.sql
,sp2.sql
...
Could anyone help me to achieve my goal using cmd to export list store?
This is my cmd build command, I need and some cmd line to export list SQL to compress with my source (into deploy_PROD_%datetime%.7z
):
@echo off
for /f %%a in ('powershell -Command "Get-Date -format yyyy.MM.dd__HH.mm"') do set datetime=%%a
del /s /q "D:\botdeploy\*"
cd /D D:\Source & git checkout PROD & git pull & git tag PROD_deploy_%datetime% & git push --tags
cd /D "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Msbuild" D:\Source\CRM.csproj /t:Restore,Rebuild /p:outdir="D:\botdeploy\\" /p:Configuration=Release & del /q "D:\botdeploy\_PublishedWebsites\CRM\Web.config" & "C:\Program Files\7-Zip\7z" a -t7z C:\Users\Nam\Desktop\deploy_PROD_%datetime%.7z D:\botdeploy\_PublishedWebsites\CRM\*
pause