aboutsummaryrefslogtreecommitdiff
path: root/aux/workflow/public.sh
blob: be32ac11158e8f550b53e9bdfaf56bf8b9a0b8d4 (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
#!/bin/sh
set -eu

PROJECT_UC=
while getopts 'n:N:m:o:l:' flag; do
	case "$flag" in
		n)
			PROJECT="$OPTARG"
			;;
		N)
			PROJECT_UC="$OPTARG"
			;;
		m)
			MAILING_LIST="$OPTARG"
			;;
		o)
			OUTDIR="$OPTARG"
			;;
		l)
			LANGS="$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'
assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
assert_arg "${OUTDIR:-}"       '-o OUTDIR'

if [ -z "${PROJECT_UC:-}" ]; then
	PROJECT_UC="$PROJECT"
fi

mkdir -p "$OUTDIR"

sh aux/workflow/TODOs.sh -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR"

sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r README.md -w index.html -Len
if [ -f CHANGELOG.md ]; then
	sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r CHANGELOG.md -Len
fi
if [ -n "${LANGS:-}" ]; then
	for lang in $LANGS; do
		sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "README.$lang.md" -w "$lang/index.html" -L "$lang"
		if [ -f CHANGELOG.md ]; then
			sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "CHANGELOG.$lang.md" -w "$lang/CHANGELOG.html" -L "$lang"
		fi
	done
fi

sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR"