Skip to content
Latchkey

Helm Chart workflow (pab1it0/prometheus-mcp-server)

The Helm Chart workflow from pab1it0/prometheus-mcp-server, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get run de-duplication, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: pab1it0/prometheus-mcp-server.github/workflows/helm-chart.ymlLicense MITView source

What it does

This is the Helm Chart workflow from the pab1it0/prometheus-mcp-server repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Helm Chart

on:
  push:
    branches: ["main"]
    tags:
      - 'v*'         # app release tags - also re-publishes the chart at HEAD
      - 'chart-v*'   # chart-only release tags, decoupled from app cadence
    paths:
      - 'charts/**'
  pull_request:
    branches: ["main"]
    paths:
      - 'charts/**'

jobs:
  lint-test:
    name: Lint and Test
    runs-on: ubuntu-latest
    timeout-minutes: 10
    permissions:
      contents: read

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Require Chart.yaml version bump when charts/ changes
        if: github.event_name == 'pull_request'
        run: |
          base="origin/${{ github.base_ref }}"
          git fetch --no-tags origin "${{ github.base_ref }}"
          if git diff --name-only "$base"...HEAD -- charts/ | grep -q .; then
            if ! git diff "$base"...HEAD -- charts/prometheus-mcp-server/Chart.yaml | grep -qE '^[+]version:'; then
              echo "::error::charts/ changed but Chart.yaml 'version:' was not bumped. Bump it per SemVer (https://semver.org)."
              exit 1
            fi
          fi

      - name: Set up Helm
        uses: azure/setup-helm@v4

      - name: Lint chart
        run: helm lint charts/prometheus-mcp-server

      - name: Template chart (default values)
        run: helm template test charts/prometheus-mcp-server

      - name: Template chart with CI values
        run: |
          for values_file in charts/prometheus-mcp-server/ci/*.yaml; do
            echo "=== Testing with $values_file ==="
            helm template test charts/prometheus-mcp-server -f "$values_file"
          done

  publish:
    name: Publish to OCI Registry
    if: github.event_name == 'push' && github.ref_type == 'tag'
    needs: lint-test
    runs-on: ubuntu-latest
    timeout-minutes: 10
    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Verify chart-v* tag matches Chart.yaml version
        if: startsWith(github.ref, 'refs/tags/chart-v')
        run: |
          tag_version="${GITHUB_REF#refs/tags/chart-v}"
          chart_version=$(grep '^version:' charts/prometheus-mcp-server/Chart.yaml | sed -E 's/^version: *"?([^"]*)"?$/\1/')
          if [ "$tag_version" != "$chart_version" ]; then
            echo "::error::tag chart-v$tag_version does not match Chart.yaml version $chart_version"
            exit 1
          fi
          echo "tag chart-v$tag_version matches Chart.yaml version $chart_version"

      - name: Set up Helm
        uses: azure/setup-helm@v4

      - name: Log in to GHCR
        run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin

      - name: Package chart
        run: helm package charts/prometheus-mcp-server

      - name: Push chart to OCI registry
        run: helm push prometheus-mcp-server-*.tgz oci://ghcr.io/pab1it0/charts

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Helm Chart
 
on:
  push:
    branches: ["main"]
    tags:
      - 'v*'         # app release tags - also re-publishes the chart at HEAD
      - 'chart-v*'   # chart-only release tags, decoupled from app cadence
    paths:
      - 'charts/**'
  pull_request:
    branches: ["main"]
    paths:
      - 'charts/**'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint-test:
    name: Lint and Test
    runs-on: latchkey-small
    timeout-minutes: 10
    permissions:
      contents: read
 
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
 
      - name: Require Chart.yaml version bump when charts/ changes
        if: github.event_name == 'pull_request'
        run: |
          base="origin/${{ github.base_ref }}"
          git fetch --no-tags origin "${{ github.base_ref }}"
          if git diff --name-only "$base"...HEAD -- charts/ | grep -q .; then
            if ! git diff "$base"...HEAD -- charts/prometheus-mcp-server/Chart.yaml | grep -qE '^[+]version:'; then
              echo "::error::charts/ changed but Chart.yaml 'version:' was not bumped. Bump it per SemVer (https://semver.org)."
              exit 1
            fi
          fi
 
      - name: Set up Helm
        uses: azure/setup-helm@v4
 
      - name: Lint chart
        run: helm lint charts/prometheus-mcp-server
 
      - name: Template chart (default values)
        run: helm template test charts/prometheus-mcp-server
 
      - name: Template chart with CI values
        run: |
          for values_file in charts/prometheus-mcp-server/ci/*.yaml; do
            echo "=== Testing with $values_file ==="
            helm template test charts/prometheus-mcp-server -f "$values_file"
          done
 
  publish:
    name: Publish to OCI Registry
    if: github.event_name == 'push' && github.ref_type == 'tag'
    needs: lint-test
    runs-on: latchkey-small
    timeout-minutes: 10
    permissions:
      contents: read
      packages: write
 
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Verify chart-v* tag matches Chart.yaml version
        if: startsWith(github.ref, 'refs/tags/chart-v')
        run: |
          tag_version="${GITHUB_REF#refs/tags/chart-v}"
          chart_version=$(grep '^version:' charts/prometheus-mcp-server/Chart.yaml | sed -E 's/^version: *"?([^"]*)"?$/\1/')
          if [ "$tag_version" != "$chart_version" ]; then
            echo "::error::tag chart-v$tag_version does not match Chart.yaml version $chart_version"
            exit 1
          fi
          echo "tag chart-v$tag_version matches Chart.yaml version $chart_version"
 
      - name: Set up Helm
        uses: azure/setup-helm@v4
 
      - name: Log in to GHCR
        run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u "${{ github.actor }}" --password-stdin
 
      - name: Package chart
        run: helm package charts/prometheus-mcp-server
 
      - name: Push chart to OCI registry
        run: helm push prometheus-mcp-server-*.tgz oci://ghcr.io/pab1it0/charts
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow