Skip to content

Commit

Permalink
Always install chart-releaser first
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyiliev committed Jan 15, 2025
1 parent 92dbb8c commit a93ea4b
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ main() {
local mark_as_latest=true
local packages_with_index=false
local pages_branch=
local latest_tag=""

parse_command_line "$@"

Expand All @@ -66,14 +67,25 @@ main() {
repo_root=$(git rev-parse --show-toplevel)
pushd "$repo_root" >/dev/null

install_chart_releaser

if [[ -z "$skip_packaging" ]]; then
if [[ "$skip_release" = true ]]; then
# Package charts without creating releases
rm -rf .cr-release-packages
mkdir -p .cr-release-packages

rm -rf .cr-index
mkdir -p .cr-index

for chart in "$charts_dir"/*; do
if [[ -d "$chart" ]]; then
package_chart "$chart"
fi
done

# Get the version from the packaged chart for output
latest_tag=$(ls .cr-release-packages/*.tgz | head -n1 | sed 's/.*\/\(.*\)\.tgz/\1/')

update_index
else
echo 'Looking up latest tag...'
Expand All @@ -85,8 +97,6 @@ main() {
readarray -t changed_charts <<<"$(lookup_changed_charts "$latest_tag")"

if [[ -n "${changed_charts[*]}" ]]; then
install_chart_releaser

rm -rf .cr-release-packages
mkdir -p .cr-release-packages

Expand Down Expand Up @@ -370,6 +380,18 @@ update_index() {
args+=(--pages-branch "$pages_branch")
fi

if [[ "$skip_release" = true ]]; then
args+=(--push --packages-with-index)

# Use helm to generate/update index directly instead of cr index
if [ -f "index.yaml" ]; then
helm repo index . --url "https://$owner.github.io/$repo" --merge index.yaml
else
helm repo index . --url "https://$owner.github.io/$repo"
fi
return
fi

echo 'Updating charts repo index...'
cr index "${args[@]}"
}
Expand Down

0 comments on commit a93ea4b

Please sign in to comment.