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

mkdir -p public

PROJECT_UC="$1"
PROJECT="$2"
README="${3:-README.md}"

RELEASES_LIST="$(mktemp)"
for version in $(git tag); do
  echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST"
done

RELEASES="$(mktemp)"
if [ -s "$RELEASES_LIST" ]; then
  printf '\n# Releases\n\n' >> "$RELEASES"
  cat "$RELEASES_LIST" >> "$RELEASES"
fi

cat "$README" "$RELEASES" | \
  pandoc --toc                                   \
         --highlight-style pygments              \
         --toc-depth=2                           \
         -s                                      \
         --metadata title="$PROJECT_UC - README" \
         --metadata lang=en                      \
         -r commonmark                           \
         -w html                                 \
         > public/index.html