mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 15:39:02 +00:00
[ci] Auto-generate chart changelogs based on Chart annotation (#1354)
Auto-generate chart changelogs based on Chart annotation
This commit is contained in:
parent
edc5e8099e
commit
c25ed8a428
2
.github/ct-lint.yaml
vendored
2
.github/ct-lint.yaml
vendored
@ -10,3 +10,5 @@ chart-repos:
|
||||
- k8s-at-home-libraries=https://library-charts.k8s-at-home.com
|
||||
- k8s-at-home=https://k8s-at-home.com/charts
|
||||
- jetstack=https://charts.jetstack.io
|
||||
additional-commands:
|
||||
- ./hack/check-releasenotes.sh {{ .Path }}
|
||||
|
14
.github/workflows/charts-lint-test.yaml
vendored
14
.github/workflows/charts-lint-test.yaml
vendored
@ -32,15 +32,10 @@ jobs:
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.1.0
|
||||
|
||||
- name: Install Dev tools
|
||||
run: |
|
||||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
|
||||
sudo chmod +x /usr/bin/yq
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
run: |
|
||||
EXCLUDED=$(yq eval -j '.excluded-charts // []' .github/ct-lint.yaml)
|
||||
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-lint.yaml)
|
||||
CHARTS=$(ct list-changed --config .github/ct-lint.yaml)
|
||||
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
||||
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
||||
@ -67,15 +62,10 @@ jobs:
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.1.0
|
||||
|
||||
- name: Install Dev tools
|
||||
run: |
|
||||
sudo wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq
|
||||
sudo chmod +x /usr/bin/yq
|
||||
|
||||
- name: Run chart-testing (list-changed)
|
||||
id: list-changed
|
||||
run: |
|
||||
EXCLUDED=$(yq eval -j '.excluded-charts // []' .github/ct-install.yaml)
|
||||
EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-install.yaml)
|
||||
CHARTS=$(ct list-changed --config .github/ct-install.yaml)
|
||||
CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]')
|
||||
OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded')
|
||||
|
81
.github/workflows/charts-release.yaml
vendored
81
.github/workflows/charts-release.yaml
vendored
@ -11,89 +11,8 @@ on:
|
||||
- 'charts/**'
|
||||
|
||||
jobs:
|
||||
generate-readme:
|
||||
name: Auto-generate chart README
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Get k8s-at-home token
|
||||
id: get-app-token
|
||||
uses: getsentry/action-github-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.K8S_AT_HOME_APP_ID }}
|
||||
private_key: ${{ secrets.K8S_AT_HOME_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ steps.get-app-token.outputs.token }}
|
||||
ref: master
|
||||
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
base: ${{ github.ref }}
|
||||
list-files: shell
|
||||
filters: |
|
||||
addedOrModified:
|
||||
- added|modified: 'charts/**'
|
||||
|
||||
- name: Install Helm
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.6.3
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Install helm-docs
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
run: |
|
||||
wget -O /tmp/helm-docs.deb https://github.com/norwoodj/helm-docs/releases/download/v1.5.0/helm-docs_1.5.0_linux_amd64.deb
|
||||
sudo dpkg -i /tmp/helm-docs.deb
|
||||
|
||||
- name: Run against changed charts
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
run: |
|
||||
CHARTS=()
|
||||
PATHS=(${{ steps.filter.outputs.addedOrModified_files }})
|
||||
# Get only the chart paths
|
||||
for i in "${PATHS[@]}"
|
||||
do
|
||||
IFS='/' read -r -a path_parts <<< "$i"
|
||||
CHARTS+=("${path_parts[1]}/${path_parts[2]}")
|
||||
done
|
||||
|
||||
# Remove duplicates
|
||||
CHARTS=( `for i in ${CHARTS[@]}; do echo $i; done | sort -u` )
|
||||
|
||||
for i in "${CHARTS[@]}"
|
||||
do
|
||||
echo "Rendering README for chart ${i}"
|
||||
IFS='/' read -r -a chart_parts <<< "$i"
|
||||
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
|
||||
./hack/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
- name: Create commit
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
push_options: --force
|
||||
commit_message: Auto-generate chart README [no ci]
|
||||
commit_user_name: k8s-at-home[bot]
|
||||
commit_user_email: k8s-at-home[bot]@users.noreply.github.com
|
||||
commit_author: k8s-at-home[bot] <k8s-at-home[bot]@users.noreply.github.com>
|
||||
file_pattern: charts/**/
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-20.04
|
||||
needs:
|
||||
- generate-readme
|
||||
steps:
|
||||
- name: Get k8s-at-home token
|
||||
id: get-app-token
|
||||
|
82
.github/workflows/generate-readme.yaml
vendored
Normal file
82
.github/workflows/generate-readme.yaml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
name: "Charts: Update Readme"
|
||||
|
||||
concurrency: update-readme
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'charts/**'
|
||||
|
||||
jobs:
|
||||
generate-readme:
|
||||
name: Auto-generate chart README
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
base: ${{ github.ref }}
|
||||
list-files: shell
|
||||
filters: |
|
||||
addedOrModified:
|
||||
- added|modified: 'charts/**'
|
||||
|
||||
- name: Install Helm
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.6.3
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
- name: Install helm-docs
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
run: |
|
||||
wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb
|
||||
sudo dpkg -i /tmp/helm-docs.deb
|
||||
|
||||
- name: Run against changed charts
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
run: |
|
||||
CHARTS=()
|
||||
PATHS=(${{ steps.filter.outputs.addedOrModified_files }})
|
||||
# Get only the chart paths
|
||||
for i in "${PATHS[@]}"
|
||||
do
|
||||
IFS='/' read -r -a path_parts <<< "$i"
|
||||
CHARTS+=("${path_parts[1]}/${path_parts[2]}")
|
||||
done
|
||||
|
||||
# Remove duplicates
|
||||
CHARTS=( `for i in ${CHARTS[@]}; do echo $i; done | sort -u` )
|
||||
|
||||
for i in "${CHARTS[@]}"
|
||||
do
|
||||
echo "Rendering README for chart ${i}"
|
||||
IFS='/' read -r -a chart_parts <<< "$i"
|
||||
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
|
||||
./hack/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
- name: Create commit
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
push_options: --force
|
||||
commit_message: Auto-generate chart README
|
||||
|
||||
commit_user_name: ${{ github.actor }}
|
||||
commit_user_email: ${{ github.actor }}@users.noreply.github.com
|
||||
|
||||
file_pattern: charts/**/
|
@ -4,23 +4,37 @@ concurrency: update-renovate-pr-changelog
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "test/**"
|
||||
paths:
|
||||
- "charts/**"
|
||||
|
||||
jobs:
|
||||
get-branch:
|
||||
name: Get branch
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
branch: ${{ steps.branch-name.outputs.current_branch }}
|
||||
|
||||
steps:
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v5.1
|
||||
|
||||
update-changelog:
|
||||
name: Update changelog
|
||||
runs-on: ubuntu-20.04
|
||||
needs:
|
||||
- get-branch
|
||||
if: startsWith(needs.get-branch.outputs.branch, 'renovate/')
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
base: ${{ github.ref }}
|
||||
list-files: shell
|
||||
filters: |
|
||||
addedOrModified:
|
||||
@ -49,17 +63,16 @@ jobs:
|
||||
./hack/renovate-releasenotes.sh "charts/${chart_parts[0]}"/"${chart_parts[1]}"
|
||||
fi
|
||||
echo ""
|
||||
cat "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml"
|
||||
done
|
||||
|
||||
# - name: Create commit
|
||||
# if: steps.filter.outputs.addedOrModified == 'true'
|
||||
# uses: stefanzweifel/git-auto-commit-action@v4
|
||||
# with:
|
||||
# push_options: --force
|
||||
# commit_message: Auto-generate chart README
|
||||
- name: Create commit
|
||||
if: steps.filter.outputs.addedOrModified == 'true'
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
push_options: --force
|
||||
commit_message: Auto-generate chart changelog annotation
|
||||
|
||||
# commit_user_name: ${{ github.actor }}
|
||||
# commit_user_email: ${{ github.actor }}@users.noreply.github.com
|
||||
commit_user_name: ${{ github.actor }}
|
||||
commit_user_email: ${{ github.actor }}@users.noreply.github.com
|
||||
|
||||
# file_pattern: charts/**/
|
||||
file_pattern: charts/**/Chart.yaml
|
||||
|
@ -2,7 +2,7 @@ apiVersion: v2
|
||||
appVersion: 8.0.7
|
||||
description: seafile helm package
|
||||
name: seafile
|
||||
version: 1.2.1
|
||||
version: 2.0.0
|
||||
kubeVersion: ">=1.16.0-0"
|
||||
keywords:
|
||||
- seafile
|
||||
@ -16,8 +16,20 @@ maintainers:
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: https://library-charts.k8s-at-home.com
|
||||
version: 4.2.0
|
||||
version: 4.3.0
|
||||
- name: mariadb
|
||||
version: 9.7.1
|
||||
version: 10.2.0
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
condition: mariadb.enabled
|
||||
annotations:
|
||||
artifacthub.io/changes: |
|
||||
- kind: changed
|
||||
description: "**Breaking:** Updated `mariadb` chart to version `10.2.0`. Check out the chart documentation to see which values have changed."
|
||||
links:
|
||||
- name: Chart documentation
|
||||
url: https://github.com/bitnami/charts/tree/master/bitnami/mariadb#to-1000
|
||||
- kind: changed
|
||||
description: Updated the common library dependency to version `4.3.0`.
|
||||
links:
|
||||
- name: Chart repository
|
||||
url: https://github.com/k8s-at-home/library-charts/tree/common-4.3.0/charts/stable/common
|
||||
|
@ -1,6 +1,6 @@
|
||||
# seafile
|
||||
|
||||
![Version: 1.2.1](https://img.shields.io/badge/Version-1.2.1-informational?style=flat-square) ![AppVersion: 8.0.7](https://img.shields.io/badge/AppVersion-8.0.7-informational?style=flat-square)
|
||||
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![AppVersion: 8.0.7](https://img.shields.io/badge/AppVersion-8.0.7-informational?style=flat-square)
|
||||
|
||||
seafile helm package
|
||||
|
||||
@ -18,8 +18,8 @@ Kubernetes: `>=1.16.0-0`
|
||||
|
||||
| Repository | Name | Version |
|
||||
|------------|------|---------|
|
||||
| https://charts.bitnami.com/bitnami | mariadb | 9.7.1 |
|
||||
| https://library-charts.k8s-at-home.com | common | 4.2.0 |
|
||||
| https://charts.bitnami.com/bitnami | mariadb | 10.2.0 |
|
||||
| https://library-charts.k8s-at-home.com | common | 4.3.0 |
|
||||
|
||||
## TL;DR
|
||||
|
||||
@ -93,25 +93,24 @@ N/A
|
||||
|
||||
## Changelog
|
||||
|
||||
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### [1.0.0]
|
||||
### Version 2.0.0
|
||||
|
||||
#### Added
|
||||
|
||||
- Initial version
|
||||
N/A
|
||||
|
||||
#### Changed
|
||||
|
||||
- N/A
|
||||
* **Breaking:** Updated `mariadb` chart to version `10.2.0`. Check out the chart documentation to see which values have changed.
|
||||
* Updated the common library dependency to version `4.3.0`.
|
||||
|
||||
#### Removed
|
||||
#### Fixed
|
||||
|
||||
- N/A
|
||||
N/A
|
||||
|
||||
[1.0.0]: #100
|
||||
### Older versions
|
||||
|
||||
A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/k8s-at-home/seafile?modal=changelog)
|
||||
|
||||
## Support
|
||||
|
||||
@ -121,4 +120,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||
|
||||
----------------------------------------------
|
||||
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
|
||||
Autogenerated from chart metadata using [helm-docs v0.1.1](https://github.com/k8s-at-home/helm-docs/releases/v0.1.1)
|
||||
|
@ -106,6 +106,36 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -
|
||||
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ $changeTypes := list "added" "changed" "fixed" }}
|
||||
## Changelog
|
||||
|
||||
### Version {{ template "chart.version" . }}
|
||||
|
||||
{{ range $changeType := $changeTypes }}
|
||||
{{- with (index $.Annotations "artifacthub.io/changes") }}
|
||||
{{- print "#### " ($changeType | title) | nindent 0 }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- $changesFound := false }}
|
||||
{{- range (print "changes:\n" . | fromYaml).changes }}
|
||||
{{- if eq .kind $changeType }}
|
||||
{{- print "* " .description | nindent 0 }}
|
||||
{{- $changesFound = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $changesFound }}
|
||||
{{- print "N/A" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
### Older versions
|
||||
|
||||
A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/k8s-at-home/{{- template "chart.name" . }}?modal=changelog)
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{ template "chart.header" . }}
|
||||
|
||||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
|
||||
|
@ -1,27 +0,0 @@
|
||||
{{- define "custom.changelog.header" -}}
|
||||
## Changelog
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ template "custom.changelog.header" . }}
|
||||
|
||||
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### [1.0.0]
|
||||
|
||||
#### Added
|
||||
|
||||
- Initial version
|
||||
|
||||
#### Changed
|
||||
|
||||
- N/A
|
||||
|
||||
#### Removed
|
||||
|
||||
- N/A
|
||||
|
||||
[1.0.0]: #100
|
||||
{{- end -}}
|
46
hack/check-releasenotes.sh
Executable file
46
hack/check-releasenotes.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
# Check if release notes have been changed
|
||||
# Usage ./check-releasenotes.sh path
|
||||
|
||||
# require yq
|
||||
command -v yq >/dev/null 2>&1 || {
|
||||
echo >&2 "yq (https://github.com/mikefarah/yq) is not installed. Aborting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Absolute path of repository
|
||||
repository=$(git rev-parse --show-toplevel)
|
||||
|
||||
# Allow for a specific chart to be passed in as a argument
|
||||
if [ $# -ge 1 ] && [ -n "$1" ]; then
|
||||
root="$1"
|
||||
chart_file="${1}/Chart.yaml"
|
||||
if [ ! -f "$chart_file" ]; then
|
||||
echo "File ${chart_file} does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Validating release notes for $root"
|
||||
|
||||
cd $root
|
||||
CURRENT=$(cat Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)
|
||||
|
||||
if [ "$CURRENT" == "" ] || [ "$CURRENT" == "null" ]; then
|
||||
echo >&2 "Release notes have not been set for this chart!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
|
||||
ORIGINAL=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e '.annotations."artifacthub.io/changes"' -P -)
|
||||
|
||||
if [ "$CURRENT" == "$ORIGINAL" ]; then
|
||||
echo >&2 "Release notes have not been updated!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo >&2 "No chart folder has been specified."
|
||||
exit 1
|
||||
fi
|
@ -16,7 +16,6 @@ repository=$(git rev-parse --show-toplevel)
|
||||
# Templates to copy into each chart directory
|
||||
readme_template="${repository}/hack/templates/README.md.gotmpl"
|
||||
readme_config_template="${repository}/hack/templates/README_CONFIG.md.gotmpl"
|
||||
readme_changelog_template="${repository}/hack/templates/README_CHANGELOG.md.gotmpl"
|
||||
|
||||
# Gather all charts using the common library, excluding common-test
|
||||
charts=$(find "${repository}" -name "Chart.yaml")
|
||||
@ -40,8 +39,6 @@ for chart in ${charts}; do
|
||||
cp "${readme_template}" "${chart_directory}"
|
||||
# Copy CONFIG template to each Chart directory, do not overwrite if exists
|
||||
cp -n "${readme_config_template}" "${chart_directory}" || true
|
||||
# Copy CHANGELOG template to each Chart directory, do not overwrite if exists
|
||||
cp -n "${readme_changelog_template}" "${chart_directory}" || true
|
||||
done
|
||||
|
||||
# Run helm-docs for charts using the common library and the common library itself
|
||||
@ -49,5 +46,4 @@ helm-docs \
|
||||
--ignore-file="${repository}/.helmdocsignore" \
|
||||
--template-files="$(basename "${readme_template}")" \
|
||||
--template-files="$(basename "${readme_config_template}")" \
|
||||
--template-files="$(basename "${readme_changelog_template}")" \
|
||||
--chart-search-root="${root}"
|
||||
|
48
hack/renovate-releasenotes.sh
Executable file
48
hack/renovate-releasenotes.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
# Check if release notes have been changed
|
||||
# Usage ./check-releasenotes.sh path
|
||||
|
||||
# require yq
|
||||
command -v yq >/dev/null 2>&1 || {
|
||||
echo >&2 "yq (https://github.com/mikefarah/yq) is not installed. Aborting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Allow for a specific chart to be passed in as a argument
|
||||
if [ $# -ge 1 ] && [ -n "$1" ]; then
|
||||
root="$1"
|
||||
chart_file="${1}/Chart.yaml"
|
||||
if [ ! -f "$chart_file" ]; then
|
||||
echo "File ${chart_file} does not exist."
|
||||
exit 1
|
||||
fi
|
||||
cd $root
|
||||
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}')
|
||||
|
||||
echo "Generating release notes for $root"
|
||||
|
||||
# Loop over all dependencies in current chart version
|
||||
NEW_DEPENDENCIES=$(cat Chart.yaml | yq e '.dependencies[].name' -P - | LC_ALL=C sort)
|
||||
OLD_DEPENDENCIES=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e '.dependencies[].name' -P - | LC_ALL=C sort)
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
trap 'rm -f "$tmpfile"' EXIT
|
||||
|
||||
for DEP_NAME in ${NEW_DEPENDENCIES[@]}
|
||||
do
|
||||
NEW_VERSION=$(cat Chart.yaml | yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P -)
|
||||
OLD_VERSION=$(git show origin/$DEFAULT_BRANCH:./Chart.yaml | yq e ".dependencies[] | select(.name == \"$DEP_NAME\") | .version" -P -)
|
||||
if [ "${NEW_VERSION}" != "${OLD_VERSION}" ]; then
|
||||
echo "- kind: changed" >> $tmpfile
|
||||
echo " description: Upgraded \`${DEP_NAME}\` chart dependency to version \`${NEW_VERSION}\`." >> $tmpfile
|
||||
fi
|
||||
done
|
||||
|
||||
yq eval-all --inplace 'select(fileIndex == 0).annotations."artifacthub.io/changes" = (select(fileIndex == 1) | to_yaml) | select(fileIndex==0)' Chart.yaml $tmpfile
|
||||
else
|
||||
echo >&2 "No chart folder has been specified."
|
||||
exit 1
|
||||
fi
|
@ -106,6 +106,36 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -
|
||||
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ $changeTypes := list "added" "changed" "fixed" }}
|
||||
## Changelog
|
||||
|
||||
### Version {{ template "chart.version" . }}
|
||||
|
||||
{{ range $changeType := $changeTypes }}
|
||||
{{- with (index $.Annotations "artifacthub.io/changes") }}
|
||||
{{- print "#### " ($changeType | title) | nindent 0 }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- $changesFound := false }}
|
||||
{{- range (print "changes:\n" . | fromYaml).changes }}
|
||||
{{- if eq .kind $changeType }}
|
||||
{{- print "* " .description | nindent 0 }}
|
||||
{{- $changesFound = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $changesFound }}
|
||||
{{- print "N/A" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
### Older versions
|
||||
|
||||
A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/k8s-at-home/{{- template "chart.name" . }}?modal=changelog)
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{ template "chart.header" . }}
|
||||
|
||||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
|
||||
|
@ -1,27 +0,0 @@
|
||||
{{- define "custom.changelog.header" -}}
|
||||
## Changelog
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ template "custom.changelog.header" . }}
|
||||
|
||||
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/commonREADME.md#Changelog).
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### [1.0.0]
|
||||
|
||||
#### Added
|
||||
|
||||
- N/A
|
||||
|
||||
#### Changed
|
||||
|
||||
- N/A
|
||||
|
||||
#### Removed
|
||||
|
||||
- N/A
|
||||
|
||||
[1.0.0]: #1.0.0
|
||||
{{- end -}}
|
@ -2,7 +2,7 @@ apiVersion: v2
|
||||
appVersion: 1.0.0
|
||||
description: ${CHARTNAME} helm package
|
||||
name: ${CHARTNAME}
|
||||
version: 2.1.0
|
||||
version: 1.0.0
|
||||
kubeVersion: ">=1.16.0-0"
|
||||
keywords:
|
||||
- ${CHARTNAME}
|
||||
@ -16,4 +16,8 @@ maintainers:
|
||||
dependencies:
|
||||
- name: common
|
||||
repository: https://library-charts.k8s-at-home.com
|
||||
version: 4.2.0
|
||||
version: 4.3.0
|
||||
annotations:
|
||||
artifacthub.io/changes: |
|
||||
- kind: added
|
||||
description: Initial version
|
||||
|
@ -86,11 +86,7 @@ N/A
|
||||
|
||||
## Changelog
|
||||
|
||||
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### [1.0.0]
|
||||
### Version 1.0.0
|
||||
|
||||
#### Added
|
||||
|
||||
@ -98,13 +94,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
#### Changed
|
||||
|
||||
- N/A
|
||||
N/A
|
||||
|
||||
#### Removed
|
||||
#### Fixed
|
||||
|
||||
- N/A
|
||||
|
||||
[1.0.0]: #1.0.0
|
||||
N/A
|
||||
|
||||
## Support
|
||||
|
||||
|
@ -106,6 +106,36 @@ helm install {{ template "chart.name" . }} {{ template "custom.helm.path" . }} -
|
||||
- Join our [Discord](https://discord.gg/sTMX7Vh) community
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ $changeTypes := list "added" "changed" "fixed" }}
|
||||
## Changelog
|
||||
|
||||
### Version {{ template "chart.version" . }}
|
||||
|
||||
{{ range $changeType := $changeTypes }}
|
||||
{{- with (index $.Annotations "artifacthub.io/changes") }}
|
||||
{{- print "#### " ($changeType | title) | nindent 0 }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- $changesFound := false }}
|
||||
{{- range (print "changes:\n" . | fromYaml).changes }}
|
||||
{{- if eq .kind $changeType }}
|
||||
{{- print "* " .description | nindent 0 }}
|
||||
{{- $changesFound = true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not $changesFound }}
|
||||
{{- print "N/A" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- print "" | nindent 0 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
### Older versions
|
||||
|
||||
A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/k8s-at-home/{{- template "chart.name" . }}?modal=changelog)
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{ template "chart.header" . }}
|
||||
|
||||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
|
||||
|
@ -1,27 +0,0 @@
|
||||
{{- define "custom.changelog.header" -}}
|
||||
## Changelog
|
||||
{{- end -}}
|
||||
|
||||
{{- define "custom.changelog" -}}
|
||||
{{ template "custom.changelog.header" . }}
|
||||
|
||||
All notable changes to this application Helm chart will be documented in this file but does not include changes from our common library. To read those click [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common#changelog).
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### [1.0.0]
|
||||
|
||||
#### Added
|
||||
|
||||
- Initial version
|
||||
|
||||
#### Changed
|
||||
|
||||
- N/A
|
||||
|
||||
#### Removed
|
||||
|
||||
- N/A
|
||||
|
||||
[1.0.0]: #100
|
||||
{{- end -}}
|
Loading…
Reference in New Issue
Block a user