blob: 4acc81b04b543041304f1bf7fd262d29675349f6 (
about) (
plain) (
blame)
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
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/sh
set -eu
TLD="$(cat aux/tld.txt)"
PROJECT_UC=
while getopts 'n:N:' flag; do
case "$flag" in
n)
PROJECT="$OPTARG"
;;
N)
PROJECT_UC="$OPTARG"
;;
*)
exit 2
;;
esac
done
shift $((OPTIND - 1))
assert_arg() {
if [ -z "$1" ]; then
echo "Missing $2" >&2
exit 2
fi
}
assert_arg "${PROJECT:-}" '-n PROJECT'
if [ -z "${PROJECT_UC:-}" ]; then
PROJECT_UC="$PROJECT"
fi
HOMEPAGE_LINK="Changelog for [$PROJECT_UC](https://$TLD/$PROJECT/en/)."
if ! grep -qF "$HOMEPAGE_LINK" CHANGELOG.md; then
echo "Missing link to homepage in CHANGELOG.md:" >&2
echo "$HOMEPAGE_LINK"
exit 1
fi
assert() {
DATE="$1"
VVERSION="$2"
VERSION="${2#v}"
CHANGELOG_ENTRY="$(printf \
'# [%s](https://git.euandreh.xyz/%s/commit/?id=%s) - %s' \
"$VERSION" "$PROJECT" "$VVERSION" "$DATE")"
if ! grep -qF "$CHANGELOG_ENTRY" CHANGELOG.md; then
echo "Missing '$CHANGELOG_ENTRY' entry from CHANGELOG.md" >&2
exit 1
fi
}
if [ -e .git ]; then
for VVERSION in $(git tag); do
DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
assert "$DATE" "$VVERSION"
done
fi
# "$@" represents a list of tags to be also included in the verification.
for VVERSION in "$@"; do
DATE="$(date '+%Y-%m-%d')"
assert "$DATE" "$VVERSION"
done
|