Fixed docker build and helm package workflows (invalid tagging) (#46)

* feat: update Helm and Docker workflows to extract chart name and version, and improve tagging logic

* fix: add github-actions-ci branch to workflow triggers for Docker and Helm packaging

* fix: add helm-package-push.yml to workflow paths for triggering on changes

* fix: improve appVersion extraction in Docker workflow and add error handling

* fix: enhance appVersion extraction with debugging output and error message

* fix: improve error handling for appVersion extraction in Docker and Helm workflows

* fix: simplify chart info extraction in Helm workflow and remove error handling

* fix: update chart info extraction to use awk for improved parsing

* fix: streamline chart info extraction in Helm workflow by removing unnecessary step and directly parsing values

* fix: remove newline characters from chart version and name extraction in Helm workflow

* Fix newline

* Update helm-package-push.yml

* Removed claude brainrot

* Update helm-package-push.yml
This commit is contained in:
Lorenzo Venerandi
2026-01-22 13:02:18 +01:00
committed by GitHub
parent b42bfdffaa
commit aaaf1d35d6
3 changed files with 59 additions and 47 deletions

View File

@@ -6,6 +6,7 @@ on:
- main
- beta
- dev
- github-actions-ci
paths:
- 'src/**'
- 'helm/Chart.yaml'
@@ -45,21 +46,29 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract appVersion from Chart.yaml
id: chart_version
- name: Extract appVersion from Chart.yaml and determine tags
id: tags
run: |
APP_VERSION=$(grep '^appVersion:' helm/Chart.yaml | awk '{print $2}' | tr -d '"')
echo "version=$APP_VERSION" >> $GITHUB_OUTPUT
APP_VERSION=$(grep '^appVersion:' helm/Chart.yaml | awk '{print $2}' | tr -d '"' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
if [ -z "$APP_VERSION" ]; then
echo "Error: Could not extract appVersion from Chart.yaml"
exit 1
fi
if [[ "${{ github.ref_name }}" == "main" ]]; then
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${APP_VERSION},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
else
TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${APP_VERSION}-${{ github.ref_name }}"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.chart_version.outputs.version }},enable={{is_default_branch}}
type=raw,value=${{ steps.chart_version.outputs.version }}-${{ github.ref_name }},enable=${{ github.ref_name != 'main' }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
@@ -67,10 +76,12 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.tags.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Image digest
run: echo ${{ steps.meta.outputs.digest }}
run: |
echo "Image built and pushed with tags:"
echo "${{ steps.tags.outputs.tags }}"