Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A gulp file I used to do CI with a habitat based website.
var gulp = require("gulp");
var gutil = require("gulp-util");
var foreach = require("gulp-foreach");
var rimrafDir = require("rimraf");
var rimraf = require("gulp-rimraf");
var runSequence = require("run-sequence");
var fs = require("fs");
var path = require("path");
var xmlpoke = require("xmlpoke");
var config = require("./gulpfile.js").config;
var unicorn = require("./scripts/unicorn.js");
var websiteRootBackup = config.websiteRoot;
gulp.task("CI-Publish", function (callback) {
config.websiteRoot = path.resolve("./Website");
config.buildConfiguration = "Release";
fs.mkdirSync(config.websiteRoot);
runSequence(
"Build-Solution",
"Publish-Foundation-Projects",
"Publish-Feature-Projects",
"Publish-Project-Projects", callback);
});
gulp.task("CI-Prepare-Package-Files", function (callback) {
var excludeList = [
config.websiteRoot + "\\bin\\{Sitecore,Lucene,Newtonsoft,System,Microsoft.Web.Infrastructure}*dll",
config.websiteRoot + "\\compilerconfig.json.defaults",
config.websiteRoot + "\\packages.config",
config.websiteRoot + "\\App_Config\\Include\\{Feature,Foundation,Project}\\z.*DevSettings.config",
"!" + config.websiteRoot + "\\bin\\Sitecore.Support*dll",
"!" + config.websiteRoot + "\\bin\\Sitecore.{Feature,Foundation,Habitat,Demo,Common}*dll"
];
console.log(excludeList);
return gulp.src(excludeList, { read: false }).pipe(rimraf({ force: true }));
});
gulp.task("CI-Copy-Items", function() {
return gulp.src("./src/**/serialization/**/*.yml")
.pipe(gulp.dest('./Data/unicorn/'));
});
gulp.task("CI-Copy-Users", function () {
return gulp.src("./src/**/users/**/*.user")
.pipe(gulp.dest('./Data/unicorn/'));
});
gulp.task("CI-Copy-Roles", function () {
return gulp.src("./src/**/roles/**/*.role")
.pipe(gulp.dest('./Data/unicorn/'));
});
gulp.task("CI-Clean", function (callback) {
rimrafDir.sync(path.resolve("./Website"));
rimrafDir.sync(path.resolve("./Data/unicorn"));
callback();
});
gulp.task("CI-Do-magic", function (callback) {
runSequence(
"CI-Clean",
"CI-Publish",
"CI-Prepare-Package-Files",
"CI-Copy-Items",
"CI-Copy-Users",
"CI-Copy-Roles",
callback);
});
@markotsoi

This comment has been minimized.

Show comment Hide comment
@markotsoi

markotsoi Mar 20, 2017

Perfect, thanks for publishing this.

Perfect, thanks for publishing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment