Secrets, environments, variables and Github actions

·

2 min read

Nowadays, I’m fiddling with Github Actions to see if I can replace Azure Devops pipelines as I’m moving my pet projects from Azure to Github — we now have unlimited private repositories, right?🤗. So far, I’m quite happy with the documentation and the number of actions available in the marketplace.

I’m not going to tell how to create a build/deploy workflow but just share a few things about the headaches I’ve had so far. I’ll be updating this post as I run into more obstacles 🤦‍♂️

Assigning a secret variable to an environment variable

In your workflow definition, you can access predefined environment variables to build your own variables. I’m just building a docker image and I’d like to tag my image with the commit id of the build. It’s as easy as shooting fish in a barrel, right? So, I’ve updated my workflow file with a new step as follows

When the job started, I was a bit surprised to see I’ve got the text $GITHUB_SHA instead of a commit id 🤯

A bit of digging showed me that things have changed after an incident and new way of setting things were described in Workflow Commands for Github. After a few tweaks, following steps are working as expected.

And don’t forget

6 hours of debugging can save 5 minutes of reading documentation.