One of the things that I wanted to be able to do was setup a full CI/CD pipeline for my blog. As someone once said If it’s worth doing, it’s worth overdoing and it was in that spirit I configured Azure DevOps to deploy Hexo.
First off a short intro to Azure DevOps. Previously known as Visual Studio Team Services (VSTS) it is a service that allows you to manage code repositories, boards, pipelines (which we’ll cover here) and even test plans. You can also use Azure Pipelines with GitHub and while I did not do that here because I wanted all my repos to be private, there is no reason you cannot use GitHub as your source repo. Especially since two weeks ago they announced free private repos.
This article will cover the following:
- Configuring your build in Azure Pipelines
- Install npm
- Install hexo-cli
- Generate the static site
- Publish the build artifacts
- Enable continuous integration
- Configuring your release in Azure Pipelines
- Select your source artifacts
- Enable AzureBlob file copy to copy content to $web
- Running your first build!
If you haven’t used Azure DevOps before there is an article covering how to get started.
I will be assuming that a few things are already in place for the purposes of this guide.
- You’ll need to get Hexo configured locally and committed to a repo. I covered how to get Hexo running in the Windows Subsystem for Linux in a previous article.
- Your site committed to an Azure DevOps or GitHub repository.
- An Azure Storage Account provisioned and static website hosting enabled. This process would likely work for other services, but this article will explain how to do it with an azure account.