Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ef2fa3f45
|
||
|
|
f39b69cf8a | ||
|
|
1717c06c93
|
||
|
|
2e4b835722 | ||
|
|
cc5be2ff10
|
||
|
|
9b531133b8 | ||
|
|
50ee92487a
|
||
|
|
6edadecfe8 | ||
|
|
38f81bbbda
|
||
|
|
2616bbc07d | ||
|
|
0d449ef5ae
|
||
|
|
29e900d32d | ||
|
|
42be4f664b
|
||
|
|
b88c651333 | ||
|
|
e5c35ae783
|
||
|
|
3047c7cc73
|
||
|
|
a10b2801d2
|
@@ -1,133 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Generate ArtifactHub changelog annotations from git commit history
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
readonly CHART_FILE="Chart.yaml"
|
|
||||||
readonly RC_PATTERN="\-rc([-\.][0-9]+)?$"
|
|
||||||
|
|
||||||
CHANGE_LOG_YAML=""
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
if [[ -n "${CHANGE_LOG_YAML:-}" && -f "${CHANGE_LOG_YAML}" ]]; then
|
|
||||||
rm -f "${CHANGE_LOG_YAML}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
if [[ ! -f "${CHART_FILE}" ]]; then
|
|
||||||
echo "ERROR: ${CHART_FILE} not found!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Exclude prerelease tags (matching -rc or -rc.<digits>) from default tag selection
|
|
||||||
DEFAULT_NEW_TAG="$(git tag --sort=-version:refname | grep --invert-match --perl-regexp "${RC_PATTERN}" | head --lines 1)"
|
|
||||||
DEFAULT_OLD_TAG="$(git tag --sort=-version:refname | grep --invert-match --perl-regexp "${RC_PATTERN}" | head --lines 2 | tail --lines 1)"
|
|
||||||
|
|
||||||
if [[ -z "${1:-}" ]]; then
|
|
||||||
read -rp "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
|
|
||||||
if [[ -z "${OLD_TAG}" ]]; then
|
|
||||||
OLD_TAG="${DEFAULT_OLD_TAG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [[ -z "$(git tag --list "${OLD_TAG}")" ]]; do
|
|
||||||
echo "ERROR: Tag '${OLD_TAG}' not found!" >&2
|
|
||||||
read -rp "Enter start tag [${DEFAULT_OLD_TAG}]: " OLD_TAG
|
|
||||||
if [[ -z "${OLD_TAG}" ]]; then
|
|
||||||
OLD_TAG="${DEFAULT_OLD_TAG}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
OLD_TAG="${1}"
|
|
||||||
if [[ -z "$(git tag --list "${OLD_TAG}")" ]]; then
|
|
||||||
echo "ERROR: Tag '${OLD_TAG}' not found!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "${2:-}" ]]; then
|
|
||||||
read -rp "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
|
|
||||||
if [[ -z "${NEW_TAG}" ]]; then
|
|
||||||
NEW_TAG="${DEFAULT_NEW_TAG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
while [[ -z "$(git tag --list "${NEW_TAG}")" ]]; do
|
|
||||||
echo "ERROR: Tag '${NEW_TAG}' not found!" >&2
|
|
||||||
read -rp "Enter end tag [${DEFAULT_NEW_TAG}]: " NEW_TAG
|
|
||||||
if [[ -z "${NEW_TAG}" ]]; then
|
|
||||||
NEW_TAG="${DEFAULT_NEW_TAG}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
NEW_TAG="${2}"
|
|
||||||
|
|
||||||
if [[ -z "$(git tag --list "${NEW_TAG}")" ]]; then
|
|
||||||
echo "ERROR: Tag '${NEW_TAG}' not found!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${NEW_TAG}" =~ ${RC_PATTERN} ]]; then
|
|
||||||
echo "INFO: Tag '${NEW_TAG}' is a prerelease, setting prerelease annotation and skipping changelog."
|
|
||||||
yq --no-colors --inplace ".annotations.\"artifacthub.io/prerelease\" = \"true\" | sort_keys(.)" "${CHART_FILE}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
CHANGE_LOG_YAML="$(mktemp)"
|
|
||||||
echo "[]" > "${CHANGE_LOG_YAML}"
|
|
||||||
|
|
||||||
map_type_to_kind() {
|
|
||||||
case "${1}" in
|
|
||||||
feat)
|
|
||||||
echo "added"
|
|
||||||
;;
|
|
||||||
fix)
|
|
||||||
echo "fixed"
|
|
||||||
;;
|
|
||||||
chore|style|test|ci|docs|refac)
|
|
||||||
echo "changed"
|
|
||||||
;;
|
|
||||||
revert)
|
|
||||||
echo "removed"
|
|
||||||
;;
|
|
||||||
sec)
|
|
||||||
echo "security"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "skip"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
COMMIT_TITLES="$(git log --pretty=format:"%s" "${OLD_TAG}..${NEW_TAG}")"
|
|
||||||
|
|
||||||
echo "INFO: Generate change log entries from ${OLD_TAG} until ${NEW_TAG}"
|
|
||||||
|
|
||||||
while IFS= read -r line; do
|
|
||||||
if [[ "${line}" =~ ^([a-zA-Z]+)(\([^\)]+\))?\:\ (.+)$ ]]; then
|
|
||||||
TYPE="${BASH_REMATCH[1]}"
|
|
||||||
KIND="$(map_type_to_kind "${TYPE}")"
|
|
||||||
|
|
||||||
if [[ "${KIND}" == "skip" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
DESC="${BASH_REMATCH[3]}"
|
|
||||||
|
|
||||||
echo "- ${KIND}: ${DESC}"
|
|
||||||
|
|
||||||
jq --arg kind "${KIND}" --arg description "${DESC}" '. += [ $ARGS.named ]' < "${CHANGE_LOG_YAML}" > "${CHANGE_LOG_YAML}.new"
|
|
||||||
mv "${CHANGE_LOG_YAML}.new" "${CHANGE_LOG_YAML}"
|
|
||||||
fi
|
|
||||||
done <<< "${COMMIT_TITLES}"
|
|
||||||
|
|
||||||
if [[ -s "${CHANGE_LOG_YAML}" ]]; then
|
|
||||||
yq --inplace --input-format json --output-format yml "${CHANGE_LOG_YAML}"
|
|
||||||
yq --no-colors --inplace ".annotations.\"artifacthub.io/changes\" |= loadstr(\"${CHANGE_LOG_YAML}\") | sort_keys(.)" "${CHART_FILE}"
|
|
||||||
else
|
|
||||||
echo "ERROR: Changelog file is empty: ${CHANGE_LOG_YAML}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
|
||||||
- uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2.0.1
|
- uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2.0.1
|
||||||
with:
|
with:
|
||||||
version: 1.3.3 # renovate: datasource=github-tags depName=oras-project/oras extractVersion='^v?(?<version>.*)$'
|
version: 1.3.4 # renovate: datasource=github-tags depName=oras-project/oras extractVersion='^v?(?<version>.*)$'
|
||||||
- name: Extract meta information
|
- name: Extract meta information
|
||||||
run: |
|
run: |
|
||||||
echo "GITEA_SERVER_HOSTNAME=$(echo "${GITHUB_SERVER_URL}" | cut -d '/' -f 3)" >> $GITHUB_ENV
|
echo "GITEA_SERVER_HOSTNAME=$(echo "${GITHUB_SERVER_URL}" | cut -d '/' -f 3)" >> $GITHUB_ENV
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
generate-parameters:
|
generate-parameters:
|
||||||
container:
|
container:
|
||||||
image: docker.io/library/node:26.7.0-alpine
|
image: docker.io/library/node:26.8.1-alpine
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install tooling
|
- name: Install tooling
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||||
with:
|
with:
|
||||||
version: v4.2.4 # renovate: datasource=github-releases depName=helm/helm
|
version: v4.3.0 # renovate: datasource=github-releases depName=helm/helm
|
||||||
- name: Lint helm files
|
- name: Lint helm files
|
||||||
run: |
|
run: |
|
||||||
helm lint --values values.yaml .
|
helm lint --values values.yaml .
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
||||||
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||||
with:
|
with:
|
||||||
version: v4.2.4 # renovate: datasource=github-releases depName=helm/helm
|
version: v4.3.0 # renovate: datasource=github-releases depName=helm/helm
|
||||||
- env:
|
- env:
|
||||||
HELM_UNITTEST_VERSION: v1.0.0 #renovate: datasource=github-releases depName=helm-unittest/helm-unittest
|
HELM_UNITTEST_VERSION: v1.0.0 #renovate: datasource=github-releases depName=helm-unittest/helm-unittest
|
||||||
name: Install helm-unittest
|
name: Install helm-unittest
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
markdown-link-checker:
|
markdown-link-checker:
|
||||||
container:
|
container:
|
||||||
image: docker.io/library/node:26.7.0-alpine
|
image: docker.io/library/node:26.8.1-alpine
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install tooling
|
- name: Install tooling
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
|
|
||||||
markdown-lint:
|
markdown-lint:
|
||||||
container:
|
container:
|
||||||
image: docker.io/library/node:26.7.0-alpine
|
image: docker.io/library/node:26.8.1-alpine
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install tooling
|
- name: Install tooling
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ jobs:
|
|||||||
|
|
||||||
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
|
||||||
with:
|
with:
|
||||||
version: "v4.2.4" # renovate: datasource=github-tags depName=helm/helm
|
version: "v4.3.0" # renovate: datasource=github-tags depName=helm/helm
|
||||||
|
|
||||||
- name: Install helm plugins
|
- name: Install helm plugins
|
||||||
env:
|
env:
|
||||||
HELM_SIGSTORE_VERSION: "0.3.0" # renovate: datasource=github-tags depName=sigstore/helm-sigstore extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
HELM_SIGSTORE_VERSION: "0.3.0" # renovate: datasource=github-tags depName=sigstore/helm-sigstore extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
||||||
HELM_SCHEMA_VALUES_VERSION: "2.5.0" # renovate: datasource=github-tags depName=losisin/helm-values-schema-json extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
HELM_SCHEMA_VALUES_VERSION: "2.6.0" # renovate: datasource=github-tags depName=losisin/helm-values-schema-json extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
||||||
HELM_UNITTEST_VERSION: "1.1.2" # renovate: datasource=github-tags depName=helm-unittest/helm-unittest extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
HELM_UNITTEST_VERSION: "1.1.2" # renovate: datasource=github-tags depName=helm-unittest/helm-unittest extractVersion='^v(?<version>\d+\.\d+\.\d+)$'
|
||||||
run: |
|
run: |
|
||||||
helm plugin install --verify=false https://github.com/sigstore/helm-sigstore.git --version "${HELM_SIGSTORE_VERSION}" 1> /dev/null
|
helm plugin install --verify=false https://github.com/sigstore/helm-sigstore.git --version "${HELM_SIGSTORE_VERSION}" 1> /dev/null
|
||||||
@@ -69,12 +69,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Add Artifacthub.io annotations
|
- uses: volker-raschek/ah-annotations@7959e52208294befed11210aef0c8e9299cc6a23 # v0.2.2
|
||||||
run: |
|
|
||||||
rc_pattern="\-rc([-\.][0-9]+)?$"
|
|
||||||
NEW_TAG="$(git tag --sort=-version:refname | grep --invert-match --perl-regexp "${rc_pattern}" | head --lines 1)"
|
|
||||||
OLD_TAG="$(git tag --sort=-version:refname | grep --invert-match --perl-regexp "${rc_pattern}" | head --lines 2 | tail --lines 1)"
|
|
||||||
.gitea/scripts/add-annotations.sh "${OLD_TAG}" "${NEW_TAG}"
|
|
||||||
|
|
||||||
- name: Extract meta information
|
- name: Extract meta information
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user