{"id":13651592,"url":"https://github.com/asmagin/Cake.Sitecore","last_synced_at":"2025-04-22T22:31:34.997Z","repository":{"id":45936008,"uuid":"132652545","full_name":"asmagin/Cake.Sitecore","owner":"asmagin","description":"The library provides a set of pre-build CAKE tasks. Those tasks could be used to simplify a configuration of CI/CD for Helix-based Sitecore projects.","archived":false,"fork":false,"pushed_at":"2021-11-26T13:43:42.000Z","size":136,"stargazers_count":11,"open_issues_count":3,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-16T09:27:37.822Z","etag":null,"topics":["cakebuild","cicd","helix","powershell","sitecore"],"latest_commit_sha":null,"homepage":"https://cakebuild.net/addins/sitecore/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asmagin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-08T19:01:12.000Z","updated_at":"2022-05-19T03:50:14.000Z","dependencies_parsed_at":"2022-09-24T18:34:35.434Z","dependency_job_id":null,"html_url":"https://github.com/asmagin/Cake.Sitecore","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmagin%2FCake.Sitecore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmagin%2FCake.Sitecore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmagin%2FCake.Sitecore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmagin%2FCake.Sitecore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asmagin","download_url":"https://codeload.github.com/asmagin/Cake.Sitecore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333962,"owners_count":21413485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cakebuild","cicd","helix","powershell","sitecore"],"created_at":"2024-08-02T02:00:50.780Z","updated_at":"2025-04-22T22:31:34.621Z","avatar_url":"https://github.com/asmagin.png","language":"PowerShell","funding_links":[],"categories":["Deployment"],"sub_categories":[],"readme":"# Cake.Sitecore\n\n[![NuGet version](https://img.shields.io/nuget/v/Cake.Sitecore.svg)](https://www.nuget.org/packages/Cake.Sitecore/)\n[![Build status](https://github.com/asmagin/Cake.Sitecore/actions/workflows/release.yaml/badge.svg)](https://github.com/asmagin/Cake.Sitecore/actions/workflows/release.yaml)\n\n## Overview\nThe library provides a set of pre-build [CAKE build] tasks. Those tasks could be used to simplify a configuration of CI/CD for Helix-based Sitecore projects.\n\n### Rationale \nCake (C# Make) is a cross-platform build automation system with a C# DSL for tasks such as compiling code, copying files and folders, running unit tests, compressing files and building NuGet packages. \nIt should be familiar for a Sitecore developers as script are written in C# and it is possible to use .NET dll and NuGet packages in them.\nThe library also provides a set of ready tasks that could be configured with environment variables, arguments and inside script, which makes it highly suitable for DevOps. As those tasks are decoupled from your build server - it makes your process highly portable (TeamCity, Jenkins, VSTS or even local machine - doesn't really matter).\n\n## Setup\nIn order to use the library you need to follow the standard [initial setup from CAKE](https://cakebuild.net/docs/tutorials/getting-started). Once you have 3 required files `build.ps1`, `build.cake` and `tools/packages.json`, open `build.cake` and add following sections there:\n\n``` cs\n// //////////////////////////////////////////////////\n// Dependencies\n// //////////////////////////////////////////////////\n#tool nuget:?package=Cake.Sitecore\u0026version=\u003ccurrent\u003e\n#load nuget:?package=Cake.Sitecore\u0026version=\u003ccurrent\u003e\n\n// ... other includes \n\n// //////////////////////////////////////////////////\n// Arguments\n// //////////////////////////////////////////////////\nvar Target = ArgumentOrEnvironmentVariable(\"target\", \"\", \"Default\");\n\n// //////////////////////////////////////////////////\n// Prepare\n// //////////////////////////////////////////////////\n\nSitecore.Constants.SetNames();\nSitecore.Parameters.InitParams(\n    context: Context, // Pass CAKE context to a library\n    msBuildToolVersion: MSBuildToolVersion.Default, // Select required version\n    solutionName: \"Habitat\", // Name of your solution\n    scSiteUrl: \"https://sc9.local\", // URL of a site\n    // ... other parameters\n);\n\n// //////////////////////////////////////////////////\n// Tasks\n// //////////////////////////////////////////////////\n\nTask(\"Restore\")\n    // predefined tasks could be used as a dependency for your build step\n    .IsDependentOn(Sitecore.Tasks.RestoreNuGetPackagesTask) \n    .IsDependentOn(Sitecore.Tasks.RestoreNpmPackagesTaskName)\n    ;\n\n// ... other tasks\n\n// //////////////////////////////////////////////////\n// Targets\n// //////////////////////////////////////////////////\n\nTask(\"Default\")\n    .IsDependentOn(\"Restore\")\n    // ... other tasks\n    ;\n\n// //////////////////////////////////////////////////\n// Execution\n// //////////////////////////////////////////////////\n\nRunTarget(Target);\n```\nFull version of this file can be found in `samples` directory.\n\n## Tasks\n### Prepare\n#### Prepare :: Configure Tools (`Sitecore.Tasks.ConfigureToolsTaskName`)\nExecutes basic configuration to optimize build performance (e.g. hide progress bars)\n\n### Clean up\n#### Clean-up :: Clean Wildcard Folders (`Sitecore.Tasks.CleanWildcardFoldersTaskName`)\nRemoves items from project `./dist` and `./App_Data` directories in each project.\n`App_Data` contains unicorn serialization files that are copied from serialization folder before publish.\n`dist` holds client side artifacts, that are generated by webpack and also copied before publish.\n\n#### Clean-up :: Clean Artifacts (`Sitecore.Tasks.CleanArtifactsTaskName`)\nCleans artifacts (`ARTIFACTS_DIR`) and output (`OUTPUT_DIR`) directories\n\n### Restore\n#### Restore :: Restore NuGet Packages (`Sitecore.Tasks.RestoreNuGetPackagesTaskName`)\nRestore NuGet packages for a solution\n\n#### Restore :: Restore NPM Packages (`Sitecore.Tasks.RestoreNpmPackagesTaskName`)\nRestore Npm packages for a solution\n\n### Build\n#### Build :: Generate Version.txt file (`Sitecore.Tasks.GenerateVersionFileTaskName`)\nCreates a file with detailed information about the build in publishing target directory (`PUBLISHING_TARGET_DIR`). The file includes:\n - current build version (`VERSION`)\n - branch name (`BRANCH_NAME`) that was used to generate it\n - commit SHA (`COMMIT`)\n - build number (`BUILD_NUMBER`)\n\nand a time of its creation in UTC.\n\n#### Build :: Set Version in package.json (`Sitecore.Tasks.SetPackageJsonVersionTaskName`)\nUpdates version in `packages.json` with current build version (`VERSION`)\n\n#### Build :: Set Version in Assembly.cs files (`Sitecore.Tasks.SetAssemblyVersionTaskName`)\nUpdates `Assembly.cs` version(`ASSEMBLY_VERSION`)before the build in each project in source directory (`SRC_DIR`).\n\n#### Build :: Download License File (`Sitecore.Tasks.DownloadLicenseFileTaskName`)\nDownload license file from remote address (`SC_LICENSE_URI`) to the (`ROOT_DIR`).\n\n#### Build :: Generate Code (`Sitecore.Tasks.GenerateCodeTaskName`)\nExecutes JS plugin to parse Unicorn files via `npm run` and generate code. Script should be called `sc:codegen`.\n\n#### Build :: Build Client Code (`Sitecore.Tasks.BuildClientCodeTaskName`)\nExecutes front-end code build via calling `npm run build:\u003cyour build configuration\u003e`. Build configurations in taken from corresponding parameter (`BUILD_CONFIGURATION`).\n\n#### Build :: Build Server Code (`Sitecore.Tasks.BuildServerCodeTaskName`)\nRuns MsBuild for a solution (`SOLUTION_FILE_PATH`) with a specific build configuration (`BUILD_CONFIGURATION`).\n\n### Unit Tests\n#### Unit Tests :: Run Server Tests (`Sitecore.Tasks.RunServerUnitTestsTaskName`)\nExecutes all available tests for server-side code using xUnit. Result will be placed into (`TESTS_OUTPUT_DIR`), also code coverage reports will be created in `cobertura` format in (`XUNIT_TESTS_COVERAGE_OUTPUT_DIR`) directory. \n\n#### Unit Tests :: Run Client Tests (`Sitecore.Tasks.RunClientUnitTestsTaskName`)\nExecutes all available tests for client-side code via `npm run test-cover`. Result **should** be placed into (`TESTS_OUTPUT_DIR`) including code coverage reports in `cobertura`. \n\n#### Unit Tests :: Merge Coverage Reports (`Sitecore.Tasks.MergeCoverageReportsTaskName`)\nMerges available code coverage reports produces by previous steps. Generates an `index` file in a coverage directory (`TESTS_COVERAGE_OUTPUT_DIR`).\n\n### Packages\n#### Packages :: Copy SPE remoting files (`Sitecore.Tasks.CopySpeRemotingFilesTaskName`)\nCopies Sitecore PowerShell Remoting (SPE) plugin assets from (`LIBS_SPE_DIR`) to the publishing target directory (`PUBLISHING_TARGET_DIR`).\n\n#### Packages :: Copy Ship files (`Sitecore.Tasks.CopyShipFilesTaskName`)\nCopies Sitecore Ship plugin assets from (`LIBS_SHIP_DIR`) to the publishing target directory (`PUBLISHING_TARGET_DIR`).\n\n#### Packages :: Prepare web.config (`Sitecore.Tasks.PrepareWebConfigTaskName`)\nTransforms `web.config` file located in config directory (`SRC_CONFIGS_DIR`) and copy it the publishing target directory (`PUBLISHING_TARGET_DIR`). This is required to make plugins work. (`SC_NODE_ENV`) will define `env:node` for Sitecore layers configurations.\n\n#### Packages :: Install (`Sitecore.Tasks.RunPackagesInstallationTaskName`)\nInstalls packages from a `libs/packages` directory (`LIBS_PACKAGES_DIR`) according to a node role (`SC_NODE_ROLE`). packages will be delivered via Sitecore Ship (`SC_SITE_URL`).\n\n### Publish\n#### Publish :: Foundation (`Sitecore.Tasks.PublishFoundationTaskName`)\nPublishes all Foundation-layer projects to the publishing target directory (`PUBLISHING_TARGET_DIR`) using MsBuild.\n\n#### Publish :: Features (`Sitecore.Tasks.PublishFeatureTaskName`)\nPublishes all Feature-layer projects to the publishing target directory (`PUBLISHING_TARGET_DIR`) using MsBuild.\n\n#### Publish :: Projects (`Sitecore.Tasks.PublishProjectTaskName`)\nPublishes all Project-layer projects to the publishing target directory (`PUBLISHING_TARGET_DIR`) using MsBuild.\n\n### Artifacts\n#### Artifacts :: Optimize (`Sitecore.Tasks.OptimizeBuildArtifactsTaskName`)\nExclude unnecessary files from target directory (`ARTIFACTS_BUILD_DIR`).\n\n#### Artifacts :: Copy configuration files (`Sitecore.Tasks.GatherBuildConfigsTaskName`)\nCopy configuration files from source config directory (`SRC_CONFIGS_DIR`) to artifact directory (`ARTIFACTS_SRC_CONFIGS_DIR`).\n\n#### Artifacts :: Copy build scripts (`Sitecore.Tasks.GatherBuildScriptsTaskName`)\nCopy build scripts from source directory (`SRC_SCRIPTS_DIR`) to artifact directory (`ARTIFACTS_SRC_DIR`).\n\n#### Artifacts :: Copy Sitecore packages (`Sitecore.Tasks.GatherSitecorePackagesTaskName`)\nCopy Sitecore packages from source directory (`LIBS_PACKAGES_DIR`) to artifact directory (`ARTIFACTS_LIBS_PACKAGES_DIR`).\n\n### Sync\n#### Sync :: Unicorn (`Sitecore.Tasks.SyncAllUnicornItemsName`)\nExecutes Unicorn content synchronization using (`SC_SITE_URL`). Secret required to authenticate services should be located in a config file (`UNICORN_CONFIG_PATH`). List of configurations can be passed via parameter (`UNICORN_CONFIGURATIONS`)\n\n## Contributing\nAny feedback, [issues](https://github.com/asmagin/Cake.Sitecore/issues) or pull requests [pull requests](https://github.com/asmagin/Cake.Sitecore/pulls) are welcome and greatly appreciated.\n## Samples\nSample usage of a CAKE-build with Habitat could be found in [here](https://github.com/asmagin/Habitat/tree/cake)  \n\n\n## Release notes\n# v.1.0.15\nSitecore Powershell Extensions updated to version 5.0\n\"ScAdminUser\" parameter default fixed - \"admin\"\n.nuspec version bumped \n\n# v.1.0.14\nFixed issue with wrong assembly version generation. Removed build number from assemsbly version and make it 0 by default. Otherwise it breaks reference for the nuget packages generated for the same {Major}.{Minor}.{Patch} version\n\n# v.1.0.8\nAdded new parameter Sitecore.Parameters.TestsFailImmediately with default boolean value = true. \nIn case of failed unit tests parameter Sitecore.Parameters.TestsFailImmediately controls if tasks Sitecore.Tasks.RunServerUnitTestsTaskName and Sitecore.Tasks.RunClientUnitTestsTaskName should fail immediately or not. Otherwise if Sitecore.Parameters.TestsFailImmediately = false unit test execution will throw an exception in the task Sitecore.Tasks.MergeCoverageReportsTaskName.\nYou can pass value to the parameter with argument:\n-TESTS_FAIL_IMMEDIATELY=false\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmagin%2FCake.Sitecore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasmagin%2FCake.Sitecore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmagin%2FCake.Sitecore/lists"}