Skip to content

Commit

Permalink
Automate docker container image version tagging from chart version (#21)
Browse files Browse the repository at this point in the history
* Automate version tagging from chart version

* Make sure a new Docker image is version tagged only when merged to main.
  • Loading branch information
shuguet authored Mar 28, 2024
1 parent 0a32d33 commit bfb5395
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ jobs:
- name: Check out code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

# Extract chart version from the chart's metadata
# https://github.com/mikefarah/yq
- name: Get Helm chart version
id: get_chart_version
uses: mikefarah/yq@master
with:
cmd: yq '.version' charts/pacman/Chart.yaml

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
Expand All @@ -35,12 +43,8 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=sha
type=raw,value=${{ steps.get_chart_version.outputs.result }},enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
# This action can be useful if you want to add emulation
Expand Down

0 comments on commit bfb5395

Please sign in to comment.