@@ -134,12 +134,63 @@ jobs:
134134 rm -f "$backup_file"
135135 echo "version=$version" >> "$GITHUB_OUTPUT"
136136
137- - name : Run chart-releaser
137+ - name : Install chart-releaser
138138 uses : helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
139139 env :
140140 CR_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
141141 with :
142- charts_dir : charts/${{ matrix.chart }}
142+ install_only : " true"
143+
144+ - name : Set package dir
145+ run : echo "PACKAGE_DIR=${{ runner.temp }}/packages" >> "$GITHUB_ENV"
146+
147+ - name : Package chart
148+ run : |
149+ mkdir -p "$PACKAGE_DIR"
150+ cr package "charts/${{ matrix.chart }}" --package-path "$PACKAGE_DIR"
151+
152+ - name : Generate release notes
153+ id : notes
154+ run : |
155+ notes_file="$RUNNER_TEMP/release-notes-${{ matrix.chart }}.md"
156+ tag_prefix="${{ matrix.chart }}-"
157+ last_tag=$(git tag -l "${tag_prefix}*" --sort=-version:refname | head -n1)
158+ log_args=()
159+ if [[ -n "$last_tag" ]]; then
160+ log_args+=("${last_tag}..HEAD")
161+ fi
162+ changes=$(git log "${log_args[@]}" --pretty=format:'- %s (%h)' -- \
163+ "charts/${{ matrix.chart }}")
164+ {
165+ echo "## Changes"
166+ if [[ -n "$changes" ]]; then
167+ echo "$changes"
168+ else
169+ echo "_No chart changes detected._"
170+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
171+ echo ""
172+ echo "_Manual bump: no chart changes detected._"
173+ fi
174+ fi
175+ } > "$notes_file"
176+ echo "notes_file=$notes_file" >> "$GITHUB_OUTPUT"
177+
178+ - name : Publish chart release and index
179+ env :
180+ CR_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
181+ run : |
182+ owner="${GITHUB_REPOSITORY_OWNER}"
183+ repo="${GITHUB_REPOSITORY#*/}"
184+ cr upload -o "$owner" -r "$repo" -c "$GITHUB_SHA" --skip-existing \
185+ --package-path "$PACKAGE_DIR"
186+ cr index -o "$owner" -r "$repo" --push --package-path "$PACKAGE_DIR"
187+
188+ - name : Update release notes
189+ env :
190+ GH_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
191+ run : |
192+ release_tag="${{ matrix.chart }}-${{ steps.version.outputs.version }}"
193+ gh release edit "$release_tag" --notes-file "${{ steps.notes.outputs.notes_file }}"
143194
144195 - name : Authenticate to GHCR
145196 uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
@@ -150,7 +201,7 @@ jobs:
150201
151202 - name : Push chart to GHCR
152203 run : |
153- package_path=".cr-release-packages /${{ matrix.chart }}-${{ steps.version.outputs.version }}.tgz"
204+ package_path="$PACKAGE_DIR /${{ matrix.chart }}-${{ steps.version.outputs.version }}.tgz"
154205 if [[ ! -f "$package_path" ]]; then
155206 echo "No packaged chart found for ${{ matrix.chart }}" >&2
156207 exit 1
0 commit comments