ci: ensure chart version is in sync with the release version

This commit is contained in:
Zaiming (Stone) Shi 2022-09-09 17:33:33 +02:00
parent 2990d16544
commit 4ff34e3188
2 changed files with 36 additions and 0 deletions

View File

@ -29,6 +29,8 @@ jobs:
run: ./scripts/update-appup.sh emqx-ee --check run: ./scripts/update-appup.sh emqx-ee --check
- name: Check apps version - name: Check apps version
run: ./scripts/apps-version-check.sh run: ./scripts/apps-version-check.sh
- name: Check chart versions
run: ./scripts/check-chart-vsn.sh
- uses: actions/upload-artifact@v3.1.0 - uses: actions/upload-artifact@v3.1.0
if: failure() if: failure()
with: with:

34
scripts/check-chart-vsn.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
# ensure dir
cd -P -- "$(dirname -- "$0")/.."
if [ -f "EMQX_ENTERPRISE" ]; then
CHART_FILE='deploy/charts/emqx-ee/Chart.yaml'
else
CHART_FILE='deploy/charts/emqx/Chart.yaml'
fi
if [ ! -f "$CHART_FILE" ]; then
echo "Chart file $CHART_FILE is not found"
pwd
exit 1
fi
CHART_VSN="$(grep -oE '^version:.*' "$CHART_FILE" | cut -d ':' -f 2 | tr -d ' ')"
APP_VSN="$(grep -oE '^appVersion:.*' "$CHART_FILE" | cut -d ':' -f 2 | tr -d ' ')"
if [ "$CHART_VSN" != "$APP_VSN" ]; then
echo "Chart version and app version mismatch in $CHART_FILE"
exit 2
fi
PKG_VSN="$(./pkg-vsn.sh | cut -d '-' -f 1)"
if [ "$CHART_VSN" != "$PKG_VSN" ]; then
echo "Chart version in $CHART_FILE is not in sync with release version."
echo "Chart version: $CHART_VSN"
echo "Release version: $PKG_VSN"
exit 3
fi