feat: Add basic logic for changelog generation (#923)
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
{{ range .Versions }}
|
||||||
|
<a name="{{ .Tag.Name }}"></a>
|
||||||
|
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
|
||||||
|
|
||||||
|
{{ range .CommitGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
|
||||||
|
{{ range .Commits -}}
|
||||||
|
* {{ .Subject }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .NoteGroups -}}
|
||||||
|
{{ range .NoteGroups -}}
|
||||||
|
### {{ .Title }}
|
||||||
|
|
||||||
|
{{ range .Notes }}
|
||||||
|
{{ .Body }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
style: github
|
||||||
|
template: CHANGELOG.tpl.md
|
||||||
|
info:
|
||||||
|
title: CHANGELOG
|
||||||
|
repository_url: https://github.com/truecharts/apps
|
||||||
|
options:
|
||||||
|
commits:
|
||||||
|
# filters:
|
||||||
|
# Type:
|
||||||
|
# - feat
|
||||||
|
# - fix
|
||||||
|
# - perf
|
||||||
|
# - refactor
|
||||||
|
commit_groups:
|
||||||
|
# title_maps:
|
||||||
|
# feat: Features
|
||||||
|
# fix: Bug Fixes
|
||||||
|
# perf: Performance Improvements
|
||||||
|
# refactor: Code Refactoring
|
||||||
|
header:
|
||||||
|
pattern: "^(\\w*)\\:\\s(.*)$"
|
||||||
|
pattern_maps:
|
||||||
|
- Type
|
||||||
|
- Subject
|
||||||
|
notes:
|
||||||
|
keywords:
|
||||||
|
- BREAKING CHANGE
|
||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
concurrency: gitpush
|
concurrency: gitpush
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/truecharts/truecharts-release:v1.0.0
|
image: ghcr.io/truecharts/truecharts-release:v1.2.0
|
||||||
steps:
|
steps:
|
||||||
- name: Cache helm repo cache
|
- name: Cache helm repo cache
|
||||||
id: cache
|
id: cache
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ jobs:
|
|||||||
release-test:
|
release-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/truecharts/truecharts-release:v1.0.0
|
image: ghcr.io/truecharts/truecharts-release:v1.2.0
|
||||||
steps:
|
steps:
|
||||||
- name: Cache helm repo cache
|
- name: Cache helm repo cache
|
||||||
id: cache
|
id: cache
|
||||||
|
|||||||
+40
-4
@@ -78,6 +78,7 @@ main() {
|
|||||||
chartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
|
chartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
|
||||||
chartname=$(basename ${chart})
|
chartname=$(basename ${chart})
|
||||||
train=$(basename $(dirname "$chart"))
|
train=$(basename $(dirname "$chart"))
|
||||||
|
create_changelog "$chart" "$chartname" "$train" "$chartversion"
|
||||||
generate_docs "$chart" "$chartname" "$train" "$chartversion"
|
generate_docs "$chart" "$chartname" "$train" "$chartversion"
|
||||||
copy_docs "$chart" "$chartname" "$train" "$chartversion"
|
copy_docs "$chart" "$chartname" "$train" "$chartversion"
|
||||||
helm dependency update "${chart}" --skip-refresh
|
helm dependency update "${chart}" --skip-refresh
|
||||||
@@ -98,6 +99,14 @@ main() {
|
|||||||
release_charts
|
release_charts
|
||||||
update_index
|
update_index
|
||||||
fi
|
fi
|
||||||
|
for chart in "${changed_charts[@]}"; do
|
||||||
|
if [[ -d "$chart" ]]; then
|
||||||
|
chartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
|
||||||
|
chartname=$(basename ${chart})
|
||||||
|
train=$(basename $(dirname "$chart"))
|
||||||
|
edit_release "$chart" "$chartname" "$train" "$chartversion"
|
||||||
|
fi
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo "Nothing to do. No chart changes detected."
|
echo "Nothing to do. No chart changes detected."
|
||||||
fi
|
fi
|
||||||
@@ -105,6 +114,30 @@ main() {
|
|||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edit_release() {
|
||||||
|
local chart="$1"
|
||||||
|
local chartname="$2"
|
||||||
|
local train="$3"
|
||||||
|
local chartversion="$4"
|
||||||
|
# In here we can in the future add code to edit the release notes of the github releases
|
||||||
|
# For example: using the github API: https://docs.github.com/en/rest/reference/repos#update-a-release
|
||||||
|
}
|
||||||
|
|
||||||
|
create_changelog() {
|
||||||
|
local chart="$1"
|
||||||
|
local chartname="$2"
|
||||||
|
local train="$3"
|
||||||
|
local chartversion="$4"
|
||||||
|
local prevversion="$(git tag -l "${chartname}-*" --sort=-v:refname | head -n 1)"
|
||||||
|
if [[ -z "$standalone" ]]; then
|
||||||
|
echo "Generating changelogs for: ${chartname}"
|
||||||
|
# SCALE "Changelog" containing only last change
|
||||||
|
git-chglog --next-tag ${chartversion} --tag-filter-pattern ${chartname} --path ${chart} ${chartversion} -o ${chart}/SCALE/CHANGELOG.md
|
||||||
|
# Append SCALE changelog to actual changelog
|
||||||
|
cat ${chart}/SCALE/CHANGELOG.md | cat - ${chart}/CHANGELOG.md > temp && mv temp ${chart}/CHANGELOG.md
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
copy_general_docs() {
|
copy_general_docs() {
|
||||||
yes | cp -rf index.yaml docs/index.yaml 2>/dev/null || :
|
yes | cp -rf index.yaml docs/index.yaml 2>/dev/null || :
|
||||||
yes | cp -rf .github/README.md docs/index.md 2>/dev/null || :
|
yes | cp -rf .github/README.md docs/index.md 2>/dev/null || :
|
||||||
@@ -176,6 +209,7 @@ copy_docs() {
|
|||||||
else
|
else
|
||||||
mkdir -p docs/apps/${train}/${chartname} || echo "app path already exists, continuing..."
|
mkdir -p docs/apps/${train}/${chartname} || echo "app path already exists, continuing..."
|
||||||
yes | cp -rf ${chart}/README.md docs/apps/${train}/${chartname}/index.md 2>/dev/null || :
|
yes | cp -rf ${chart}/README.md docs/apps/${train}/${chartname}/index.md 2>/dev/null || :
|
||||||
|
yes | cp -rf ${chart}/CHANGELOG.md docs/apps/${train}/${chartname}/CHANGELOG.md 2>/dev/null || :
|
||||||
yes | cp -rf ${chart}/CONFIG.md docs/apps/${train}/${chartname}/CONFIG.md 2>/dev/null || :
|
yes | cp -rf ${chart}/CONFIG.md docs/apps/${train}/${chartname}/CONFIG.md 2>/dev/null || :
|
||||||
yes | cp -rf ${chart}/helm-values.md docs/apps/${train}/${chartname}/helm-values.md 2>/dev/null || :
|
yes | cp -rf ${chart}/helm-values.md docs/apps/${train}/${chartname}/helm-values.md 2>/dev/null || :
|
||||||
sed -i '1s/^/# License<br>\n\n/' docs/apps/${train}/${chartname}/LICENSE.md 2>/dev/null || :
|
sed -i '1s/^/# License<br>\n\n/' docs/apps/${train}/${chartname}/LICENSE.md 2>/dev/null || :
|
||||||
@@ -207,12 +241,14 @@ patch_apps() {
|
|||||||
local chartversion="$4"
|
local chartversion="$4"
|
||||||
local target="catalog/${train}/${chartname}/${chartversion}"
|
local target="catalog/${train}/${chartname}/${chartversion}"
|
||||||
echo "Applying SCALE patches for App: ${chartname}"
|
echo "Applying SCALE patches for App: ${chartname}"
|
||||||
mv ${target}/SCALE/ix_values.yaml ${target}/
|
rm -rf ${target}/CHANGELOG.md 2>/dev/null || :
|
||||||
mv ${target}/SCALE/questions.yaml ${target}/
|
mv ${target}/SCALE/CHANGELOG.md ${target}/CHANGELOG.md 2>/dev/null || :
|
||||||
|
mv ${target}/SCALE/ix_values.yaml ${target}/ 2>/dev/null || :
|
||||||
|
mv ${target}/SCALE/questions.yaml ${target}/ 2>/dev/null || :
|
||||||
cp -rf ${target}/SCALE/templates/* ${target}/templates 2>/dev/null || :
|
cp -rf ${target}/SCALE/templates/* ${target}/templates 2>/dev/null || :
|
||||||
mv ${target}/SCALE/item.yaml catalog/${train}/${chartname}/item.yaml
|
mv ${target}/SCALE/item.yaml catalog/${train}/${chartname}/item.yaml
|
||||||
rm -rf ${target}/SCALE
|
rm -rf ${target}/SCALE 2>/dev/null || :
|
||||||
mv ${target}/values.yaml ${target}/test_values.yaml
|
mv ${target}/values.yaml ${target}/test_values.yaml 2>/dev/null || :
|
||||||
touch ${target}/values.yaml
|
touch ${target}/values.yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user