Skip to content

ci(helm): Ensure diff in make helm fails the build #363

ci(helm): Ensure diff in make helm fails the build

ci(helm): Ensure diff in make helm fails the build #363

name: Build Helm Chart
on:
push:
branches: [ main ]
tags: [ 'ci-*' ]
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
- 'NOTICE'
- 'PROJECT'
- 'SECURITY_CONTACTS'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '*.md'
- 'docs/**'
- 'LICENSE'
- 'NOTICE'
- 'PROJECT'
- 'SECURITY_CONTACTS'
permissions:
contents: read
jobs:
build-helm-chart:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Print tag
id: tag
run: |
TAG=$(make tag)
echo "Generated tag: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Generate helm chart
run: make helm TAG=${{ steps.tag.outputs.tag }}
- name: Check helm chart is up to date
run: |
if [[ -n "$(git status --porcelain -- charts/templates/)" ]]; then
echo "::error::Helm chart templates are out of date. Run 'make helm' and commit the result."
git status --porcelain -- charts/templates/
git diff -- charts/templates/
exit 1
fi
- name: Package helm chart
run: make helm-package TAG=${{ steps.tag.outputs.tag }}
- name: Upload helm chart artifact
uses: actions/upload-artifact@v4
with:
name: byoh-helm-chart
path: byoh-chart-*.tgz
retention-days: 1
- name: Log in to helm registry
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/ci-') }}
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
run: make helm-login
- name: Push helm chart
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/ci-') }}
run: make helm-push TAG=${{ steps.tag.outputs.tag }}