Building My Blog with GitHub Actions
So I Changed My DevOps
As some may know, I already had a fully working CI/CD process for my blog and it was running on Azure Pipelines. As someone that is always learning and wanting to play with a new tool, I was pretty intrigued when GitHub Actions was formally announced at GitHub Universe. I wanted to see how challenging it would be to move my DevOps process from Azure Pipelines to GitHub Actions and it was not hard at all.
Actions 101
If you aren't familar, GitHub Actions is the mechanism inside of GitHub for CI/CD (they call them workflows) and is written in [YAML [Yet Another Markup Language]](https://yaml.org/). If you read the [docs](https://help.github.com/en/actions/automating-your-workflow-with-github-actions), you can take a look at the structures that make up a workflow and even choose from a ton of existing Actions that have been developed my Third-Party Vendors, or community members as well, so even though you can create them yourself, you have the ability to leverage hundreds of them to build a workflow that fits your needs.
Making a Workflow to Fit My Needs
The first thing that I did in building my workflow was to identify the steps to get my app from source to a static-site in Azure Blob Storage. It isn't hard but all I have to do is Build and Deploy
- Build the app using Hugo Cli
- Deploy built bits to specific container in Azure Blob Storage
Way too simple here, so now that I have this, I need to determine what I need in my workflow to complete this. Funny enough both these steps exist as created Actions in the Marketplace, so I then just need to specify when this Action runs and what platform it runs on (in my case Ubuntu).
All in all, my action looks like this.
```yaml name: Build and Publish Blog to Azure Blob Storage
on: [push]
jobs: build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: chabad360/hugo-actions@master
with:
buildPath: 'public'
hugoVersion: ''
args: ''
- uses: bacongobbler/azure-blob-storage-upload@v1.0.0
with:
source_dir: public
container_name: $web
connection_string: ${{ secrets.ConnString }}
extra_args: ''
|
|