Skip to content

Instantly share code, notes, and snippets.

View karol-blaszczyk's full-sized avatar
🎯
Focusing

Karol Błaszczyk karol-blaszczyk

🎯
Focusing
View GitHub Profile
@karol-blaszczyk
karol-blaszczyk / README.md
Created January 16, 2023 21:11 — forked from palewire/README.md
How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

How to push tagged Docker releases to Google Artifact Registry with a GitHub Action

Here's how I configured a GitHub Action so that a new version issued by GitHub's release interface will build a Dockerfile, tag it with the version number and upload it to Google Artifact Registry.

Before you attempt the steps below, you need the following:

  • A GitHub repository that contains a working Dockerfile
  • The Google Cloud SDK tool gcloud installed and authenticated

Create a Workload Identity Federation

# git repo status in prompt functions
# ripped from <https://github.com/twolfson/sexy-bash-prompt/blob/master/.bash_prompt>
# with small changes
#
function _get_git_branch() {
# On branches, this will return the branch name
# On non-branches, (no branch)
_REF="$(git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///')"
if [[ $_REF != "" ]]; then
echo $_REF