mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* 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>
94 lines
3.0 KiB
YAML
94 lines
3.0 KiB
YAML
name: Chart Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'chart-v*'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
prepare_release:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag_name: ${{ steps.tag.outputs.tag_name }}
|
|
chart_version: ${{ steps.tag.outputs.chart_version }}
|
|
app_version: ${{ steps.tag.outputs.app_version }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Resolve chart release tag
|
|
id: tag
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
# Read the canonical version from the Rails app (single source of truth)
|
|
APP_SEMVER=$(grep -oP '"\K[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' config/initializers/version.rb | head -n 1 || true)
|
|
if [ -z "$APP_SEMVER" ]; then
|
|
echo "::error::Could not extract version from config/initializers/version.rb"
|
|
exit 1
|
|
fi
|
|
echo "App version from version.rb: $APP_SEMVER"
|
|
|
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
# Use the app version as the chart version (monorepo: versions stay in sync)
|
|
TAG_NAME="chart-v${APP_SEMVER}"
|
|
|
|
if git rev-parse "refs/tags/${TAG_NAME}" >/dev/null 2>&1; then
|
|
echo "::error::Tag ${TAG_NAME} already exists. Bump the version in config/initializers/version.rb and charts/sure/Chart.yaml first."
|
|
exit 1
|
|
fi
|
|
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
if ! git tag "$TAG_NAME"; then
|
|
echo "::error::Failed to create tag ${TAG_NAME}"
|
|
exit 1
|
|
fi
|
|
if ! git push origin "$TAG_NAME"; then
|
|
echo "::error::Failed to push tag ${TAG_NAME} to origin"
|
|
exit 1
|
|
fi
|
|
else
|
|
TAG_NAME="${GITHUB_REF_NAME}"
|
|
fi
|
|
|
|
CHART_VERSION="${TAG_NAME#chart-v}"
|
|
|
|
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
|
echo "chart_version=$CHART_VERSION" >> "$GITHUB_OUTPUT"
|
|
echo "app_version=$APP_SEMVER" >> "$GITHUB_OUTPUT"
|
|
|
|
publish_chart:
|
|
needs: prepare_release
|
|
uses: ./.github/workflows/helm-publish.yml
|
|
with:
|
|
chart_version: ${{ needs.prepare_release.outputs.chart_version }}
|
|
app_version: ${{ needs.prepare_release.outputs.app_version }}
|
|
update_gh_pages: true
|
|
secrets: inherit
|
|
|
|
release:
|
|
needs: [prepare_release, publish_chart]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download Helm chart artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: helm-chart-package
|
|
path: ${{ runner.temp }}/helm-artifacts
|
|
|
|
- name: Create chart GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.prepare_release.outputs.tag_name }}
|
|
name: ${{ needs.prepare_release.outputs.tag_name }}
|
|
generate_release_notes: true
|
|
files: ${{ runner.temp }}/helm-artifacts/*.tgz
|