Add GitHub workflow for building Keycloak Helm chart
Some checks failed
Build Helm Chart / helm-package (push) Failing after 3s

This commit introduces a new workflow file for building the Helm chart
for Keycloak in the Gitea CI/CD pipeline. The workflow is triggered on
push events to the main branch specifically when changes are made to
the "charts/keycloak/Chart.yaml" file.

The workflow includes several steps:
- **Checkout the repository**: It pulls the latest code.
- **Set Helm Chart App Name and Version**: It extracts the app name
  and version from the Chart.yaml file, allowing the Helm package to
  be named correctly.
- **Setup Helm**: It installs Helm version 3.18.3 for packaging
  purposes.
- **Package Helm Chart**: It updates dependencies, lints the chart,
  and packages it into a tgz file.
- **Upload Helm Package**: It uploads the newly created Helm chart
  package to the specified Helm registry using credentials stored in
  Gitea secrets.

This addition is necessary to automate the process of building and
deploying the Helm chart, ensuring consistency and efficiency in the
CI/CD pipeline.
This commit is contained in:
2025-08-10 11:07:17 +02:00
parent c084706fc8
commit d14c607713

View File

@@ -0,0 +1,43 @@
name: "Build Helm Chart"
on:
push:
branches:
- main
paths:
- "charts/keycloak/Chart.yaml"
jobs:
helm-package:
runs-on: ubuntu-latest
env:
APP: charts/keycloak
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set Helm Chart App Name and Version
id: get_version
run: |
APP_NAME=$(grep -oP '(?<=^name: ).*' ${{ env.APP }}/Chart.yaml)
echo "Helm Chart App Name: $APP_NAME"
echo "::set-output name=app::$APP_NAME"
CHART_VERSION=$(grep -oP '(?<=^version: ).*' ${{ env.APP }}/Chart.yaml)
echo "Helm Chart version: $CHART_VERSION"
echo "::set-output name=tag::$CHART_VERSION"
- name: Setup Helm
run: |
#curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
curl -kSso /usr/local/bin/helm https://debmirror.cooltux.net/helm-v3.18.3 && chmod +x /usr/local/bin/helm
helm version
- name: Package Helm Chart
run: |
helm dependency update ${{ env.APP }}
helm lint ${{ env.APP }}
helm package ${{ env.APP }}
- name: Upload Helm Package to repo
run: |
curl --user ${{ secrets.USER }}:${{ secrets.TOKEN }} -X POST --upload-file ./${{ steps.get_version.outputs.app }}-${{ steps.get_version.outputs.tag }}.tgz ${{ vars.HELMREGISTRY }}/api/packages/${{ vars.OWNER }}/helm/api/charts