-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_changelog.sh
executable file
·39 lines (31 loc) · 1.37 KB
/
generate_changelog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Runs github-changelog-generator and generate a new changelog based on current release-summary
# With flag -d it generates a delta changelog to use with github release notes otherwise it creates a full changelog
# More info in README.md
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts "d:" opt; do
case "$opt" in
d) delta="yes"
;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
if [[ $delta == "yes" ]];then
latest_release_tag=`gh release list | cut -d 'L' -f1 | awk '{$1=$1};1' | head -n1`
TAG=`git fetch && git tag | tail -n1`
latest_release_tag=`gh release list | cut -d 'L' -f1 | awk '{$1=$1};1' | head -n1`
if [[ $TAG == $latest_release_tag ]];then
echo "WARN: Latest tag is matching latest release tag; nothing to do here. Quitting..."
exit 1
fi
docker run -it -e latest_release_tag=$latest_release_tag --rm \
-v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator \
-u iomarcovalente -p helloworld-overkill --no-unreleased --since-tag $latest_release_tag \
--output CHANGELOG.delta.md
else
docker run -it --rm \
-v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator \
-u iomarcovalente -p helloworld-overkill --no-unreleased
fi