I want to have a miniature ci loop on my private projects and was thinking if I could run msbuild inside a batfile I could have colorized feedback on the cmd window and automate the build. So if I could just trigger the bat from the post - commit hook I guess it would be possible. It can´t possible be a new idea but I can´t find any examples on google.
any input would be appreciated :)
@eckes' answer was close but actually was running my bat/cmd files as if they were bash scripts. If you want to run them as batch files, here is what worked for me:
#!/bin/sh
# important that it's got the .exe on the end!
cmd.exe /c "C:\path\to\somebatch.cmd"
Here's some stuff/envrionment variables etc that you might find useful:
@echo off
:: read commit hook stdin data e.g. "aa45321… 68f7abf… refs/heads/master"
set /p OLDREV_NEWREV_REFNAME=
echo Directory of this script is %~dp0
echo Repository root is %CD%
set OLDREV=%OLDREV_NEWREV_REFNAME:~0,40%
echo OLDREV: %OLDREV%
set NEWREV=%OLDREV_NEWREV_REFNAME:~41,40%
echo NEWREV: %NEWREV%
set REFNAME=%OLDREV_NEWREV_REFNAME:~82,999%
echo REFNAME: %REFNAME%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With