48 lines
1.1 KiB
Bash
Executable file
48 lines
1.1 KiB
Bash
Executable file
#/bin/sh
|
|
|
|
HELM_REPO=${HELM_REPO:-codeberg.org/wrenix/flux-charts}
|
|
HELM_REPO_URL="oci://${HELM_REPO}"
|
|
COMMIT_SCOPE=${2:-fix}
|
|
COMMIT_MESSAGE=${1:-"update appVersion"}
|
|
|
|
|
|
|
|
ct lint # || exit 1
|
|
|
|
for p in * ; do
|
|
if \
|
|
[ ! -d $p ] || \
|
|
[ $p == template ] || \
|
|
[ $p == docs ] || \
|
|
[ ! -f $p/Chart.yaml ] \
|
|
; then
|
|
continue
|
|
fi
|
|
|
|
echo "=== ${p} ===";
|
|
lastVersion=$(oras repo tags "${HELM_REPO}/${p}" | sort --sort=version | tail -1)
|
|
echo "last pkg: ${lastVersion}"
|
|
v=$(dasel -f "${p}/Chart.yaml" -s version)
|
|
echo "version: ${v}";
|
|
if [ "${v}" == "${lastVersion}" ]; then
|
|
echo "nothing changed"
|
|
echo
|
|
continue
|
|
fi
|
|
echo
|
|
|
|
echo "update docs"
|
|
helm-docs -t ./README.md.gotmpl -t _docs.gotmpl -o README.md -g "${p}"
|
|
|
|
echo "package and push helm-chart"
|
|
helm package "${p}"
|
|
helm push "${p}-${v}.tgz" "${HELM_REPO_URL}";
|
|
oras tag "${HELM_REPO}/${p}:${v}" "${v%\.[0-9]*}" "${v%\.[0-9]*\.[0-9]*}" "latest"
|
|
|
|
echo "push to git"
|
|
git add "${p}/"
|
|
git commit -m "${COMMIT_SCOPE}(${p}): ${COMMIT_MESSAGE}"
|
|
git push origin main;
|
|
|
|
echo
|
|
done
|