CI/CD for Your Sitecore Pet Project Using AppVeyor.

CICD-for-Your-Sitecore-Pet-Project-Using-AppVeyor

There is lots of information about how to build continuous integration, continuous delivery and continuous deployment for enterprise Sitecore projects. But, none of these include information about Sitecore projects on GitHub with CI/CD (at least I haven’t faced with them). That is why I have decided to write a step-by-step guide on how to get CI/CD for your Sitecore pet project for free.

Let’s start:

  1. Create accounts forGitHuband AppVeyor(using authorization via GitHub)
  2. Create your Sitecore project and push it to GitHub
  3. Create and push appveyor.yml file to your repository
  4. #Version of project could be based on build number
    version: 1.0.{build}
    #Path(s) to artifacts. We will create Sitecore update package and ship it as artifact
    artifacts:
      - path: build\artifacts\*.update
        name: Sitecore.Akamai
    before_build:
      #Configure Nuget to use public Sitecore packages feed
      - nuget sources add -Name SitecorePublicFeed -Source https://sitecore.myget.org/F/sc-packages/api/v3/index.json
      #Restore packages configured in solution
      - nuget restore Sitecore.Akamai.sln
    build:
      #Solution file
      project: Sitecore.Akamai.sln
    #Configuration of deployment artifacts to GitHub as release. It is not possible to save artifacts on Appveyor due to limited time of storage (30 days)
    after_build:
      #Run PowerShell script that will build .update Sitecore package
      - ps: .\build\build.ps1  
    deploy:
      #Release name
      release: Sitecore.Akamai-v$(appveyor_build_version)
      #Description of release
      description: 'Using Akamai features inside Sitecore'
      #Deploy to GitHub
      provider: GitHub
      #Secure token to upload files to GitHub https://www.appveyor.com/docs/deployment/github/
      auth_token:
        secure: rkLSxUbN2YMMG/r6lzLq1PN0n07dqJBtk/8ZR2c/InGy0SBOsmqGXfIQWMQOZUAs 
      draft: false
      prerelease: false
      on:
        branch: master                # release from master branch only
        appveyor_repo_tag: true       # deploy on tag push only
    install:
      #Intallation of Sitecore.Courier Powershell module to have ability to build Sitecore package
      - ps: Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      #Intallation of Sitecore.Courier to have ability to build Sitecore package
      - choco install sitecore-courier
  5. Commit and push powershell script that will prepare Sitecore update package with files and items using Sitecore.Courier
  6. #Get package version from Appveyor
    $version = $env:APPVEYOR_BUILD_VERSION
    if ($version -eq $null) {
        $version = "1.0.0"
    }
    "Package version: " + $version
     
    #Clear build directories
    Remove-Item build\package -Recurse -ErrorAction Ignore
    Remove-Item build\artifacts -Recurse -ErrorAction Ignore
    #Create directories structure for package
    New-Item -Name build\package -ItemType directory
    New-Item -Name build\artifacts -ItemType directory
    New-Item -Name build\package\Data -ItemType directory
    New-Item -Name build\package\bin -ItemType directory
    New-Item -Name build\package\App_Config\Include\Foundation -ItemType directory
     
    #Copy Sitecore items and assemblies to proper location
    Copy-Item .\src\Foundation\Akamai\code\bin\Foundation.Akamai* .\build\package\bin
    Copy-Item .\src\Foundation\Akamai\code\App_Config\Include\Foundation\Foundation.Sitecore.Akamai.config .\build\package\App_Config\Include\Foundation
    Copy-Item .\src\Foundation\Akamai\serialization\* .\build\package\Data -recurse
     
    #Run Sitecore Courier to prepare .update package
    $packageCmd = "Sitecore.Courier.Runner.exe -t build\package -o build\artifacts\sitecore.akamai." + $version + ".update -r"
    iex $packageCmd
  1. Add a new project to Appveyor from GitHub
  2. Configure the publishing of artifacts. Create a new GitHub token. Encrypt it using AppVeyor and update appveyor.yml with new encrypted value.
  3. Update readme.md file with badge of build status

That is all. After next commit to your GitHub repo, new AppVeyor build will be triggered and Sitecore update package will be prepared. Sitecore update package will be available from artifacts tab on build details page. New GitHub release will be created after the creation of the new tag in the repository. The release will contain an archive of source files and Sitecore .update package. Update package will contain files and items and could be installed on any Sitecore website using update installation wizard.

As a bonus, you can configure code metrics on Sonar Cloud for free:

  1. Create a new Sonar Cloud account using GitHub authorization
  2. Generate new Sonar Cloud token and encrypt it using AppVeyor
  3. Change you appveyor.yml configuration:
  4. before_build:
      #Start SonarQube runner
      - MSBuild.SonarQube.Runner.exe begin /k:"Sitecore.Akamai" /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=%sonar_token%" /d:"sonar.organization=github-antonytm" /n:"Sitecore.Akamai"
    after_build:
      #Stop SonarQube runner
      - MSBuild.SonarQube.Runner.exe end /d:"sonar.login=%sonar_token%"
      - ps: .\build\build.ps1  
    environment:
      sonar_token:
        secure: xxx #Put your encrypted Sonar Cloud token here
    install:
      #Install msbuild SonarQube runner
      - choco install "msbuild-sonarqube-runner" -y
  5. Update readme.md file with Sonar Cloud code quality badges.
  6. It took some time to set up this configuration first time. But for the second project, it took less than half an hour. This free lightweight cloud CI/CD is a good investment in saving your time to avoid preparing new builds manually. And you should not necessarily select services described in this article. It is only one way that was shown as an example. GitHub could be replaced with Bitbucket, AppVeyor with TravisCI, etc.

    You can see all this in action inside my repository on GitHub.

Want to read more of my technical content and how to guides? You can find all my blogs here.

Whatever your business, be it a regional or global brand, the content you produce plays a vital role in your success. You know that… hence you’re reading this.

A well formulated and executed content strategy not only drives more traffic, at the core, it defines what your business is and helps build a strong connection between you and your audiences.

So let's quickly look at why developing a coherent content strategy is important and how setting clear goals and understanding your audience will elevate your online performance. 

What is a Content Strategy?

It's basic right? Content is at the core of how you define the way your business presents itself and an effective strategy should look to ensure that tone of voice, messaging and the core values are surfaced across all channels, from service or product pages on your website, to blog posts, through social media updates blah blah blah.

But let's keep it simple - your content strategy should be a clear roadmap that connects your marketing activities to your business goals. Align to your customer’s wants and needs and engage them at every interaction point and boom, you're in business. 

Who are my Audience?

You likely start all your projects with this chalked on the wall because your business knows “exactly” who its customers are right? Sounds obvious but we often find its not been done forensically enough (not based on data), is too old (more than 12 months ago - forget it) or its a spin off from some brand work that was legitimately aspirational but doesn’t face the reality of who you your business is actually engaging today.

So start (or circle back) with audience research, building out those personas to understand their ambitions, their lifestyle, their pain points or concerns, and crucially their wants and needs - in your context. 

Do I need to tailor content?

As part of your research find out where your audiences spend their time online and how they interact with content: Some may spend time thoroughly researching a product or service, whereas other audiences may want their content to be quick, snappy or easily digestible in the form of a video, infographic or short blog posts.

 

Ultimately, the key is to produce a strategy that creates the type of content your customers want to see:

  • What are the problems that your product or service will help them solve?

  • Who are they most influenced by?

  • What voices influence their behaviour?

  • What type of content do they consume?

  • Where do they consume content and engage with brands?

Different Content, Different Objectives

 All content is not born equal: When producing your strategy, it is important that the objectives for each individual piece are defined, that these fulfil your marketing objectives and tie to the overarching goals for your business.

There are various content frameworks that exist to aid content development in this way, but one that is popular and effective is Google’s hero, hub and hygiene method: It provides a framework on developing content to achieve different goals and gives guidance on the effort needed to create each type of content.

Hero Content

Hero content is essentially campaign content, it is big splash ideas designed to appeal to a large audience with the aim of telling your brand’s story at scale. 

Ways of measuring hero include the amount of PR mentions or links from authoritative domains plus social interactions and mentions of your brand across all channels. 

Considering the scale of hero campaigns, this content is not regularly produced and is reserved for peak promotional times where it’s important for a business to stand out from their competitors.

Hub Content

Hub content is the stuff that keeps your audience engaged, it expands on the themes of product or service level content, educates users and helps create a connection between themselves and your brand.

Hygiene Content

Hygiene content is the bread and butter of any website, it is the BAU content for products and services, it is SEO focused and targets important keywords at a product, service or guide level.

How do I manage all this?

Content development is only one part of the ongoing work needed when working with an effective content strategy. We call it “feeding the beast” because it really is the fuel in your brand vehicle and once you start you really can’t stop (if it’s delivering results) but that’s where performance measurement comes in.

Your greatest gift in managing the outputs from your hero/hub/hygiene style efforts is to understand If your content is working. To truly deliver results your business must first understand the objectives and goals of each piece of content to effectively measure its success. That as a guiding light from day 1 will let you slow down, speed up, stop or start new content briefs and projects.

Remember - content strategies are not set in stone. They are living breathing things and should adapt and pivot as insights become available and your brand naturally evolves.

If ever you want to chat content and explore new initiatives we’re always here to help.

want to speak to one of our experts?

 
Anton Tishchenko Thumbnail
Anton Tishchenko
Head of Digital Engineering
Anton has worked as a developer since 2007, he is a highly experienced Sitecore developer who previously worked as a Technical Team Lead at Sitecore. Anton's expertise in the Sitecore platform is formidable; he's definitely one of the world's finest Sitecore ninjas and in 2019 he was recognised as the only Sitecore MVP in the Ukraine when he achieved his Technology MVP Status.
Anton Tishchenko Thumbnail

Anton Tishchenko

07 Aug 2018 - 7 minute read
share this

stay in the know, stay ahead.

Get the latest from the agency, including news, events and expert content.
find out what we can do for you
read some of our case studies