Created
September 26, 2024 19:16
-
-
Save afruzan/26e1eb210d131b6a2ed1e1c58ccf63ca to your computer and use it in GitHub Desktop.
dotnet publish command with git semantic versioning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /F %%i in ('git describe --dirty --broken --tags --match v*.*') do set OUT=%%i | |
set "SUFFIX=%OUT:*-=%" | |
set "VERSION=%OUT:-="&:"%" | |
if "%SUFFIX%" == "%OUT%" set "SUFFIX=" | |
set "VERSION=%VERSION:~1%" | |
echo "Publish directory: '%cd%\Publish\%OUT%'" | |
echo "Version: %VERSION% - Version-Suffix: %SUFFIX%" | |
echo "Publish App service..." | |
dotnet publish "dir\App.csproj" -c Release -o "Publish\%OUT%\App.Service" -p:BuildSpa=true -p:VersionPrefix=%VERSION% -p:VersionSuffix=%SUFFIX% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great