Files
sure/.github/workflows/chart-ci.yml
Juan José Mata e70865e939 Sync Helm chart and Rails app versions in CI and release workflows (#1030)
* Sync Helm chart and Rails app versions in CI and release workflows

- values.yaml: default image.tag to "" so it uses Chart.appVersion
  (was hardcoded to stale "0.6.6" while app was at 0.6.8-alpha.13)
- chart-ci.yml: add version-sync job that fails if version.rb,
  Chart.yaml version, and Chart.yaml appVersion diverge; trigger on
  version.rb changes too
- chart-release.yml: derive chart version from version.rb (single
  source of truth) instead of auto-incrementing independent chart-v* tags

https://claude.ai/code/session_01Eq3WHBn3Uwjezxb6ctdjMB

* Default to `false` AI_DEBUG_MODE

* Apply suggestions from CodeRabbit

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Juan José Mata <jjmata@jjmata.com>

---------

Signed-off-by: Juan José Mata <jjmata@jjmata.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-02-20 10:04:07 +01:00

86 lines
2.7 KiB
YAML

name: Chart CI
on:
pull_request:
paths:
- 'charts/**'
- 'config/initializers/version.rb'
- '.github/workflows/chart-ci.yml'
push:
branches:
- main
paths:
- 'charts/**'
- 'config/initializers/version.rb'
- '.github/workflows/chart-ci.yml'
jobs:
version-sync:
name: Verify Helm ↔ Rails version sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check version alignment
shell: bash
run: |
set -euo pipefail
RAILS_VERSION=$(grep -oP '"\K[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' config/initializers/version.rb | head -n 1 || true)
if [ -z "$RAILS_VERSION" ]; then
echo "::error::Could not extract a version string from config/initializers/version.rb — ensure it contains a quoted semver like VERSION = \"1.2.3\""
exit 1
fi
CHART_VERSION=$(sed -n 's/^version: //p' charts/sure/Chart.yaml | head -n 1)
APP_VERSION=$(sed -n 's/^appVersion: "\{0,1\}\([^"]*\)"\{0,1\}/\1/p' charts/sure/Chart.yaml | head -n 1)
echo "Rails version (version.rb): $RAILS_VERSION"
echo "Helm chart version (Chart.yaml): $CHART_VERSION"
echo "Helm appVersion (Chart.yaml): $APP_VERSION"
ERRORS=0
if [ "$RAILS_VERSION" != "$CHART_VERSION" ]; then
echo "::error::Chart version ($CHART_VERSION) does not match Rails version ($RAILS_VERSION)"
ERRORS=$((ERRORS + 1))
fi
if [ "$RAILS_VERSION" != "$APP_VERSION" ]; then
echo "::error::Chart appVersion ($APP_VERSION) does not match Rails version ($RAILS_VERSION)"
ERRORS=$((ERRORS + 1))
fi
if [ "$ERRORS" -gt 0 ]; then
echo ""
echo "To fix: ensure version in config/initializers/version.rb matches"
echo "both 'version' and 'appVersion' in charts/sure/Chart.yaml"
exit 1
fi
echo "All versions are in sync."
helm-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v4.3.1
- name: Add chart dependencies repositories
run: |
helm repo add cloudnative-pg https://cloudnative-pg.github.io/charts
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts
helm repo update
- name: Build chart dependencies
run: helm dependency build charts/sure
- name: Lint chart
run: helm lint charts/sure
- name: Render templates
run: helm template sure charts/sure --kube-version 1.25.0 >/tmp/sure-chart-rendered.yaml