Skip to content

Instantly share code, notes, and snippets.

@fillet54
Last active August 29, 2015 13:58
Show Gist options
  • Save fillet54/10002057 to your computer and use it in GitHub Desktop.
Save fillet54/10002057 to your computer and use it in GitHub Desktop.
Ghost deploy.cmd Deployment section
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------
:Deployment
echo Handling node.js grunt deployment.
:: 1. Select node version
call :SelectNodeVersion
:: 2. Overwrite NODE_ENV when doing the npm/bower/grunt work.
setlocal
set NODE_ENV=development
:: 3. Install npm packages.
:: DO NOT use --production since grunt is a development dependency
IF EXIST "%DEPLOYMENT_SOURCE%/package.json" (
echo "Running npm install"
call :ExecuteCmd !NPM_CMD! install
IF !ERRORLEVEL! NEQ 0 goto error"
)
:: 4. Run bower
IF EXIST "%DEPLOYMENT_SOURCE%/bower.json" (
echo "Running bower install"
call :ExecuteCmd "./node_modules/.bin/bower" install
IF !ERRORLEVEL! NEQ 0 goto error
)
:: 5. Run grunt
IF EXIST "%DEPLOYMENT_SOURCE%/Gruntfile.js" (
echo "Running Grunt init"
call :ExecuteCmd "./node_modules/.bin/grunt" --no-color init
IF !ERRORLEVEL! NEQ 0 goto error
echo "Running Grunt prod"
call :ExecuteCmd "./node_modules/.bin/grunt" --no-color prod
IF !ERRORLEVEL! NEQ 0 goto error
)
:: 6. Put back NODE_ENV to whatever it's set to in App Settings
endlocal
echo "NODE_ENV=%NODE_ENV%"
:: 7. KuduSync to Target
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 500 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
IF !ERRORLEVEL! NEQ 0 goto error
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment