* 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
77 lines
2.2 KiB
YAML
77 lines
2.2 KiB
YAML
name: Package and Push Helm Chart
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- beta
|
|
- dev
|
|
- github-actions-ci
|
|
paths:
|
|
- 'helm/**'
|
|
- '.github/workflows/helm-package-push.yml'
|
|
tags:
|
|
- 'v*'
|
|
release:
|
|
types:
|
|
- published
|
|
- created
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ${{ vars.DOCKER_REGISTRY }}
|
|
|
|
jobs:
|
|
package-and-push:
|
|
runs-on: self-hosted
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v4
|
|
with:
|
|
version: 'latest'
|
|
|
|
- name: Log in to Container Registry
|
|
run: |
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
|
|
|
|
- name: Set Helm chart version and package
|
|
run: |
|
|
CHART_NAME=$(grep '^name:' ./helm/Chart.yaml | awk '{print $2}')
|
|
BASE_VERSION=$(grep '^version:' ./helm/Chart.yaml | awk '{print $2}')
|
|
|
|
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
|
CHART_VERSION="${BASE_VERSION}"
|
|
else
|
|
CHART_VERSION="${BASE_VERSION}-${{ github.ref_name }}"
|
|
fi
|
|
|
|
# Update Chart.yaml temporarily with the versioned name
|
|
sed -i "s/^version:.*/version: ${CHART_VERSION}/" ./helm/Chart.yaml
|
|
|
|
# Package the helm chart
|
|
helm package ./helm
|
|
|
|
echo "CHART_NAME=${CHART_NAME}" >> $GITHUB_ENV
|
|
echo "CHART_VERSION=${CHART_VERSION}" >> $GITHUB_ENV
|
|
|
|
- name: Push Helm chart to registry
|
|
run: |
|
|
helm push ${{ env.CHART_NAME }}-${{ env.CHART_VERSION }}.tgz oci://${{ env.REGISTRY }}
|
|
|
|
- name: Chart pushed
|
|
run: |
|
|
CHART_VERSION=$(grep '^version:' ./helm/Chart.yaml | awk '{print $2}')
|
|
CHART_FILE=$(grep '^name:' ./helm/Chart.yaml | awk '{print $2}')
|
|
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
|
echo "Chart pushed: ${CHART_FILE}:${CHART_VERSION}"
|
|
else
|
|
echo "Chart pushed: ${CHART_FILE}:${CHART_VERSION}-${{ github.ref_name }}"
|
|
fi
|