Skip to content

Commit 66351f5

Browse files
feat: add changelog (#513)
1 parent 4286302 commit 66351f5

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed

charts/cf-runtime/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
description: A Helm chart for Codefresh Runner
33
name: cf-runtime
4-
version: 6.4.4
4+
version: 6.4.5
55
keywords:
66
- codefresh
77
- runner
@@ -17,8 +17,8 @@ annotations:
1717
artifacthub.io/containsSecurityUpdates: "false"
1818
# Supported kinds: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`:
1919
artifacthub.io/changes: |
20-
- kind: security
21-
description: "updating docker-puller with security fixes"
20+
- kind: added
21+
description: "add changelog into release"
2222
dependencies:
2323
- name: cf-common
2424
repository: oci://quay.io/codefresh/charts

charts/cf-runtime/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Codefresh Runner
22

3-
![Version: 6.4.4](https://img.shields.io/badge/Version-6.4.4-informational?style=flat-square)
3+
![Version: 6.4.5](https://img.shields.io/badge/Version-6.4.5-informational?style=flat-square)
44

55
Helm chart for deploying [Codefresh Runner](https://codefresh.io/docs/docs/installation/codefresh-runner/) to Kubernetes.
66

scripts/generate-changelog.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Check if the correct number of arguments is provided
4+
if [ "$#" -ne 2 ]; then
5+
echo "Usage: $0 <path_to_Chart.yaml> <path_to_CHANGELOG.md>"
6+
exit 1
7+
fi
8+
9+
# Assign input arguments to variables
10+
CHART_YAML="$1"
11+
CHANGELOG_FILE="$2"
12+
13+
# Check if the Chart.yaml file exists
14+
if [ ! -f "$CHART_YAML" ]; then
15+
echo "Error: Chart.yaml file not found at $CHART_YAML"
16+
exit 1
17+
fi
18+
19+
# Extract the artifacthub.io/changes section from the Chart.yaml
20+
CHANGES=$(sed -n '/artifacthub.io\/changes: |/,/^dependencies:/p' "$CHART_YAML" | sed '1d;$d')
21+
22+
echo $CHANGES
23+
24+
# Create associative arrays to store changes by kind
25+
declare -A changes_by_kind
26+
27+
# Iterate through the changes and group them by kind
28+
current_kind=""
29+
while read -r line; do
30+
if [[ $line == *"- kind:"* ]]; then
31+
current_kind=$(echo "$line" | sed 's/.*kind: //')
32+
# Initialize an empty array for the kind if it doesn't exist
33+
if [[ -z "${changes_by_kind[$current_kind]}" ]]; then
34+
changes_by_kind[$current_kind]=""
35+
fi
36+
elif [[ $line == *"description:"* ]]; then
37+
description=$(echo "$line" | sed 's/.*description: "//;s/"//')
38+
# Append the description to the corresponding kind
39+
changes_by_kind[$current_kind]+="- $description"$'\n'
40+
fi
41+
done <<< "$CHANGES"
42+
43+
# Create the CHANGELOG.md file and write the header
44+
echo "# Changelog" > "$CHANGELOG_FILE"
45+
echo "" >> "$CHANGELOG_FILE"
46+
47+
# Write the changes grouped by kind to the CHANGELOG.md file
48+
for kind in "${!changes_by_kind[@]}"; do
49+
if [[ -n "${changes_by_kind[$kind]}" ]]; then
50+
echo "## $kind" >> "$CHANGELOG_FILE"
51+
echo "${changes_by_kind[$kind]}" >> "$CHANGELOG_FILE"
52+
fi
53+
done

0 commit comments

Comments
 (0)