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

Commit

Permalink
added script to generate release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameer Naik committed Nov 20, 2020
1 parent 3875dc9 commit 118c118
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions scripts/release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env sh

RELEASE=${1:-${GIT_TAG}}
RELEASE=${RELEASE:-${CIRCLE_TAG}}

if [ -z "${RELEASE}" ]; then
echo "Usage:"
echo "release-notes.sh VERSION"
exit 1
fi

if ! git rev-list ${RELEASE} >/dev/null 2>&1; then
echo "${RELEASE} does not exist"
exit
fi

REPO="knative-lambda-runtime"
BASE_URL="https://github.com/triggermesh/${REPO}/releases/download/${RELEASE}"
PREV_RELEASE=${PREV_RELEASE:-$(git describe --tags --abbrev=0 ${RELEASE}^ 2>/dev/null)}
PREV_RELEASE=${PREV_RELEASE:-$(git rev-list --max-parents=0 ${RELEASE}^ 2>/dev/null)}
NOTABLE_CHANGES=$(git cat-file -p ${RELEASE} | sed '/-----BEGIN PGP SIGNATURE-----/,//d' | tail -n +6)
CHANGELOG=$(git log --no-merges --pretty=format:'- [%h] %s (%aN)' ${PREV_RELEASE}..${RELEASE})
if [ $? -ne 0 ]; then
echo "Error creating changelog"
exit 1
fi

RUNTIMES=$(sed -n -e "s/^\(RUNTIMES[[:space:]]*=[[:space:]]*\)\(.*\)$/\2/p" Makefile)
RELEASE_ASSETS_TABLE=$(
echo -n "|"; for runtime in ${RUNTIMES}; do echo -n " ${runtime} |"; done ; echo
echo -n "|"; for runtime in ${RUNTIMES}; do echo -n "--|"; done ; echo
echo -n "|"
for runtime in ${RUNTIMES}; do
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})"
echo -n " |"
done
echo
)

cat <<EOF
${NOTABLE_CHANGES}
## Installation
Download TriggerMesh Knative Lambda Runtime ${RELEASE}
${RELEASE_ASSETS_TABLE}
## Changelog
${CHANGELOG}
EOF

0 comments on commit 118c118

Please sign in to comment.