Skip to content

Commit 7bf41b9

Browse files
committed
refactor(ci): merge publish_charts into build_release to reduce script dependencies
1 parent f7759f6 commit 7bf41b9

2 files changed

Lines changed: 30 additions & 72 deletions

File tree

scripts/build_release.sh

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ set -euo pipefail
44

55
# Build and release Helm charts to Harbor OCI registry and S3 backup.
66
# Decrypts Harbor and rclone credentials from the development repository,
7-
# logs into the registry, then delegates to publish_charts.sh.
7+
# logs into the registry, then releases each chart.
88
#
99
# Usage (CI mode):
1010
# bash ./scripts/build_release.sh -p chart1 chart2
1111
#
12+
# Usage (CI mode, force dev release):
13+
# FORCE_DEV=true bash ./scripts/build_release.sh -p chart1 chart2
14+
#
1215
# Usage (dev mode, no push):
1316
# bash ./scripts/build_release.sh chart1
1417

@@ -67,16 +70,38 @@ end_group "Setup rclone config"
6770

6871
## Release charts
6972
##
70-
begin_group "Release charts"
73+
FORCE_DEV="${FORCE_DEV:-false}"
74+
75+
# Set git identity for tag creation — CI mode only
76+
if [ "$CI" = true ]; then
77+
git config user.name "github-actions[bot]"
78+
git config user.email "github-actions[bot]@users.noreply.github.com"
79+
fi
7180

7281
if [ "$PUBLISH" = true ]; then
73-
bash "$THIS_DIR/publish_charts.sh" "$@"
82+
for CHART in "$@"; do
83+
VERSION=$(sed -En 's/^version: (.*)$/\1/p' "charts/${CHART}/Chart.yaml")
84+
TAG_NAME="${CHART}-${VERSION}"
85+
86+
begin_group "Release ${CHART} (${VERSION})"
87+
88+
if [ "$FORCE_DEV" = "true" ]; then
89+
echo "-> FORCE_DEV enabled, releasing dev version (0.0.0-dev)"
90+
bash "$THIS_DIR/release-dev-chart.sh" "${CHART}"
91+
elif git show-ref --tags "${TAG_NAME}" --quiet; then
92+
echo "-> Tag ${TAG_NAME} already exists, releasing dev version (0.0.0-dev)"
93+
bash "$THIS_DIR/release-dev-chart.sh" "${CHART}"
94+
else
95+
echo "-> Tag ${TAG_NAME} not found, releasing production version (${VERSION})"
96+
bash "$THIS_DIR/release-chart.sh" "${CHART}"
97+
fi
98+
99+
end_group "Release ${CHART} (${VERSION})"
100+
done
74101
else
75102
echo "-> Dry run mode: skipping publish (use -p to publish)"
76103
fi
77104

78-
end_group "Release charts"
79-
80105
## Logout from Harbor OCI registry
81106
##
82107
helm registry logout "$KALISIO_HARBOR_URL"

scripts/publish_charts.sh

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)