- Auto-update Chart.yaml version from release tag or manual input - Add strict helm lint validation before publishing - Validate chart templates with multiple configuration scenarios - Ensures chart quality before publishing to GitHub Pages
84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
name: Release Helm Chart to GitHub Pages
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
chart_version:
|
|
description: "Chart version (e.g., 4.28.0)"
|
|
required: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "$GITHUB_ACTOR"
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v4
|
|
with:
|
|
version: v3.15.2
|
|
|
|
- name: Determine chart version
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
VERSION="${{ inputs.chart_version }}"
|
|
else
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
VERSION="${VERSION#v}"
|
|
fi
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Update Chart.yaml version
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.version }}"
|
|
sed -i "s/^version: .*/version: $VERSION/" deploy/helm/pulse/Chart.yaml
|
|
sed -i "s/^appVersion: .*/appVersion: \"$VERSION\"/" deploy/helm/pulse/Chart.yaml
|
|
|
|
# Commit if changed (for manual workflow runs)
|
|
if ! git diff --quiet deploy/helm/pulse/Chart.yaml; then
|
|
git config user.name "$GITHUB_ACTOR"
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
git add deploy/helm/pulse/Chart.yaml
|
|
git commit -m "Auto-update Helm chart version to $VERSION"
|
|
git push
|
|
fi
|
|
|
|
- name: Validate Helm chart
|
|
run: |
|
|
# Strict linting
|
|
helm lint deploy/helm/pulse --strict
|
|
|
|
# Template validation with minimal values
|
|
helm template pulse deploy/helm/pulse --set persistence.enabled=false > /dev/null
|
|
|
|
# Template validation with common overrides
|
|
helm template pulse deploy/helm/pulse \
|
|
--set ingress.enabled=true \
|
|
--set ingress.hosts[0].host=pulse.example.com \
|
|
--set agent.enabled=true > /dev/null
|
|
|
|
echo "✓ Chart validation passed"
|
|
|
|
- name: Run chart-releaser
|
|
uses: helm/chart-releaser-action@v1.6.0
|
|
with:
|
|
charts_dir: deploy/helm
|
|
config: cr.yaml
|
|
skip_existing: true
|
|
env:
|
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
CR_RELEASE_NAME_TEMPLATE: "helm-chart-{{ .Version }}"
|