-
Notifications
You must be signed in to change notification settings - Fork 11
/
entrypoint.sh
54 lines (46 loc) · 1.51 KB
/
entrypoint.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
cd /github/workspace/
while getopts "n:c:o:t:" opt; do
case ${opt} in
c )
if [ -z "${OPTARG}" ]; then
echo "::error ::git-chlog path is not set using flag '-c <configuration directory>'"
exit 1
fi
config=$OPTARG
;;
n )
if [ ! -z ${OPTARG} ]; then
next_tag="--next-tag ${OPTARG}"
fi
;;
o )
if [ ! -z ${OPTARG} ]; then
output="${OPTARG}"
fi
;;
t )
tag="${OPTARG}"
;;
esac
done
shift $((OPTIND -1))
if [ -f "${config}/config.yml" ] && [ -f "${config}/CHANGELOG.tpl.md" ]; then
echo "::debug ::git-chlog: -c '${config}'"
echo "::debug ::git-chlog: -n '${next_tag}'"
echo "::debug ::git-chlog: -o '${output}'"
echo "::debug ::git-chlog: -t '${tag}'"
echo "::info ::git-chlog executing command: /usr/local/bin/git-chglog --config "${config}/config.yml" ${next_tag} ${tag}"
changelog=$(/usr/local/bin/git-chglog --config "${config}/config.yml" ${next_tag} ${tag})
echo "----------------------------------------------------------"
echo "${changelog}"
echo "----------------------------------------------------------"
echo "::debug ::git-chlog: -o '${output}'"
if [[ ! -z "$output" ]]; then
echo "::debug ::git-chlog -o options is set. writing changelog to ${output}"
echo "${changelog}" > ${output}
fi
echo "::set-output name=changelog::$( echo "$changelog" | jq -sRr @uri )"
else
echo "::warning ::git-chlog configuration was not found, skipping changelog generation."
fi