Skip to content

Instantly share code, notes, and snippets.

@ryhanen
Last active October 22, 2016 07:35
Show Gist options
  • Select an option

  • Save ryhanen/51399d1f32efb02f2e47 to your computer and use it in GitHub Desktop.

Select an option

Save ryhanen/51399d1f32efb02f2e47 to your computer and use it in GitHub Desktop.
Customized Azure deployment script that will run Gulp tasks during deployment
##################################################################################################################################
# Deployment
# ----------
echo Handling node.js deployment.
# 1. Select node version
selectNodeVersion
# 2. Install npm packages
if [ -e "$DEPLOYMENT_SOURCE/package.json" ]; then
cd "$DEPLOYMENT_SOURCE"
eval $NPM_CMD install --production
exitWithMessageOnError "npm failed"
cd - > /dev/null
fi
# 3. Run gulp tasks
if [ -e "$DEPLOYMENT_SOURCE/gulpfile.js" ]; then
echo "Running gulp tasks"
cd "$DEPLOYMENT_SOURCE"
eval './node_modules/.bin/gulp'
exitWithMessageOnError "gulp failed"
cd - > /dev/null
fi
# 4. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh;node_modules;package.json;gulpfile.js;.gitignore;.htaccess"
exitWithMessageOnError "Kudu Sync failed"
fi
##################################################################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment