Skip to content

Instantly share code, notes, and snippets.

Embed
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.

Copy link

markotsoi commented Mar 20, 2017

Perfect, thanks for publishing this.

@gauravjain83

This comment has been minimized.

Copy link

gauravjain83 commented Jun 21, 2018

Hi,

The above script works for Sitecore Habitat 8 but when i use the above script as a build step in TeamCity and deploy using Octopus on a plain vanila Sitecore 9 instance it throws exception. The package is missing some of the dll's of habitat feature.

Could you please the updated gulp-ci which is compatible for Sitecore Habitat 9?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.