Skip to content

Remove latest tag in value files (#739) #12

Remove latest tag in value files (#739)

Remove latest tag in value files (#739) #12

# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: Update the helm charts 0-latest
on:
push:
branches:
- main
paths:
- helm-charts/**
env:
CHARTS_DIR: "helm-charts"
jobs:
release-on-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Get the modified charts list
run: |
echo "This job runs after a PR is merged!"
if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "0-latest"; then
echo "Version check failed, only update 0-latest"
exit 1
fi
base_commit=$(git rev-parse HEAD~1) # push event
merged_commit=$(git log -1 --format='%H')
# Update components
common_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \
grep "^$CHARTS_DIR/common" | \
grep -vE 'README.md|*.sh' | \
cut -d'/' -f3 | sort -u )
echo "Charts to be updated: $common_charts"
echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u opea --password-stdin
pushd $CHARTS_DIR/common
for chart in ${common_charts}; do
echo "Updating $chart"
helm dependency update ${chart}
helm package $chart
helm push ${chart}-0-latest.tgz oci://ghcr.io/opea-project/charts
done
popd
# Update Examples
e2e_charts=$(git diff --name-only ${base_commit} ${merged_commit} | \
grep "^$CHARTS_DIR" | \
grep -vE 'README.md|valuefiles.yaml|common|*.sh' | \
cut -d'/' -f2 | sort -u )
echo "Charts to be updated: $e2e_charts"
echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u opea --password-stdin
pushd $CHARTS_DIR
for chart in ${e2e_charts}; do
echo "Updating $chart"
helm dependency update ${chart}
helm package $chart
helm push ${chart}-0-latest.tgz oci://ghcr.io/opea-project/charts
done
popd