Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 118c118

Browse files
author
Sameer Naik
committed
added script to generate release notes
1 parent 3875dc9 commit 118c118

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

scripts/release-notes.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env sh
2+
3+
RELEASE=${1:-${GIT_TAG}}
4+
RELEASE=${RELEASE:-${CIRCLE_TAG}}
5+
6+
if [ -z "${RELEASE}" ]; then
7+
echo "Usage:"
8+
echo "release-notes.sh VERSION"
9+
exit 1
10+
fi
11+
12+
if ! git rev-list ${RELEASE} >/dev/null 2>&1; then
13+
echo "${RELEASE} does not exist"
14+
exit
15+
fi
16+
17+
REPO="knative-lambda-runtime"
18+
BASE_URL="https://github.com/triggermesh/${REPO}/releases/download/${RELEASE}"
19+
PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^ 2>/dev/null)}
20+
PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^ 2>/dev/null)}
21+
NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6)
22+
CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE})
23+
if [ $? -ne 0 ]; then
24+
echo "Error creating changelog"
25+
exit 1
26+
fi
27+
28+
RUNTIMES=$(sed -n -e "s/^\(RUNTIMES[[:space:]]*=[[:space:]]*\)\(.*\)$/\2/p" Makefile)
29+
RELEASE_ASSETS_TABLE=$(
30+
echo -n "|"; for runtime in ${RUNTIMES}; do echo -n " ${runtime} |"; done ; echo
31+
echo -n "|"; for runtime in ${RUNTIMES}; do echo -n "--|"; done ; echo
32+
echo -n "|"
33+
for runtime in ${RUNTIMES}; do
34+
echo -n " [container](https://gcr.io/triggermesh/knative-lambda-$(echo "${runtime}" | sed -n -e "s/\([[:alnum:]]*\)\(-\)*\([0-9]*\)\(\.\)*\([0-9]*\)\(\.\)*\([0-9]*\).*/\1\3\5\7/p"):${RELEASE})"
35+
echo -n " |"
36+
done
37+
echo
38+
)
39+
40+
cat <<EOF
41+
${NOTABLE_CHANGES}
42+
43+
## Installation
44+
45+
Download TriggerMesh Knative Lambda Runtime ${RELEASE}
46+
47+
${RELEASE_ASSETS_TABLE}
48+
49+
## Changelog
50+
51+
${CHANGELOG}
52+
EOF

0 commit comments

Comments
 (0)