chore: add changelog automatically
parent
856e4de1dc
commit
76820f88a4
|
@ -31,3 +31,5 @@
|
|||
|
||||
### driftctl
|
||||
/.driftignore
|
||||
|
||||
CHANGELOG.md
|
||||
|
|
|
@ -39,6 +39,11 @@ if [ "$CI" != true ]; then
|
|||
FLAGS+="--snapshot "
|
||||
fi
|
||||
|
||||
if [ "$CI" == true ] && [ "$CMD" == "release" ]; then
|
||||
./scripts/changelog.sh > CHANGELOG.md
|
||||
FLAGS+="--release-notes CHANGELOG.md "
|
||||
fi
|
||||
|
||||
CMD="goreleaser ${CMD} ${FLAGS}"
|
||||
|
||||
echo "+ Building using goreleaser"
|
||||
|
|
|
@ -25,34 +25,26 @@ fi
|
|||
# Keep IDs of merged pull requests
|
||||
PRs=$(git log --pretty=oneline $BASE...$LATEST_TAG | grep 'Merge pull request #' | grep -oP '#[0-9]+' | sed 's/#//')
|
||||
|
||||
echo "Generating changelog for commits from $BASE to $LATEST_TAG..."
|
||||
|
||||
# Generating changelog for commits from $BASE to $LATEST_TAG
|
||||
CHANGES=()
|
||||
for pr in $PRs; do
|
||||
str=$($GHCLI_BIN pr view $pr --repo $REPO -t '- {{ .title }} (#{{ .number }}) @{{ .author.login }} {{.labels}}' --json title,number,author,labels)
|
||||
CHANGES+=("$str")
|
||||
done
|
||||
|
||||
echo -e "\n## 🚀 Enhancements\n"
|
||||
|
||||
for change in "${CHANGES[@]}"; do
|
||||
if [[ $change =~ "kind/enhancement" ]]; then
|
||||
echo $change | sed "s/\[map\[$PARTITION_COLUMN.*//"
|
||||
print_changes() {
|
||||
local label=$1
|
||||
local title=$2
|
||||
if [[ "${CHANGES[@]}" =~ $label ]]; then
|
||||
echo -e $title
|
||||
for change in "${CHANGES[@]}"; do
|
||||
if [[ $change =~ $label ]]; then
|
||||
echo $change | sed "s/\[map\[$PARTITION_COLUMN.*//"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
echo -e "\n## 🐛 Bug Fixes\n"
|
||||
|
||||
for change in "${CHANGES[@]}"; do
|
||||
if [[ $change =~ "kind/bug" ]]; then
|
||||
echo $change | sed "s/\[map\[$PARTITION_COLUMN.*//"
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\n## 🔨 Maintenance\n"
|
||||
|
||||
for change in "${CHANGES[@]}"; do
|
||||
if [[ $change =~ "kind/maintenance" ]]; then
|
||||
echo $change | sed "s/\[map\[$PARTITION_COLUMN.*//"
|
||||
fi
|
||||
done
|
||||
print_changes "kind/enhancement" "## 🚀 Enhancements"
|
||||
print_changes "kind/bug" "## 🐛 Bug Fixes"
|
||||
print_changes "kind/maintenance" "## 🔨 Maintenance"
|
||||
|
|
Loading…
Reference in New Issue