diff options
Diffstat (limited to 'aux/workflow')
-rwxr-xr-x | aux/workflow/TODOs.sh | 36 | ||||
-rwxr-xr-x | aux/workflow/assert-changelog.sh | 5 | ||||
-rwxr-xr-x | aux/workflow/assert-readme.sh | 7 | ||||
-rwxr-xr-x | aux/workflow/assert-todos.sh | 3 | ||||
-rwxr-xr-x | aux/workflow/commonmark.sh | 45 | ||||
-rwxr-xr-x | aux/workflow/public.sh | 41 | ||||
-rwxr-xr-x | aux/workflow/sign-tarballs.sh | 15 |
7 files changed, 70 insertions, 82 deletions
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh index 96cb064..efc0b04 100755 --- a/aux/workflow/TODOs.sh +++ b/aux/workflow/TODOs.sh @@ -39,21 +39,21 @@ if [ -z "${PROJECT_UC:-}" ]; then PROJECT_UC="$PROJECT" fi -TODOS_ADD_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX) (.*) \{#(.*?)\}(.*)$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\4\n<pre class="header-anchor" id="\3">#\3<\/pre>\n/' -TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g' -TODOS_CLEANUP_REGEX1='s/(<a><a)/<a/' -TODOS_CLEANUP_REGEX2='s/<\/a><\/a>/<\/a>/' -sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ - -e "s:@PROJECT@:$PROJECT:g" \ - -e "s:@MAILING_LIST@:$MAILING_LIST:g" \ - -e "s:@TLD@:$TLD:g" \ - < aux/workflow/preamble.md | \ - printf \ - '%s\n\n' \ - "$(cat - TODOs.md)" | \ - perl -pe "$TODOS_ADD_REGEX" | \ - perl -pe "$TAGS_REGEX" | \ +# shellcheck disable=1004 +IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DONE\|WONTFIX\) \(.*\) {#\(.*\)}\(.*\)$:## <a href="#\3"><span class="\1">\1</span> \2</a>\4\ +<pre class="header-anchor" id="\3">#\3</pre>\ +:g' +TAGS_REGEX='s|tag:\([a-z0-9-]*\)|<span class="tag">\1</span>|g' + +cat aux/workflow/preamble.md TODOs.md | + sed \ + -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ + -e "s:@PROJECT@:$PROJECT:g" \ + -e "s:@MAILING_LIST@:$MAILING_LIST:g" \ + -e "s:@TLD@:$TLD:g" \ + -e "$IDS_REGEX" \ + -e "$TAGS_REGEX" | pandoc \ --toc \ --highlight-style pygments \ @@ -64,8 +64,8 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ -r commonmark \ -w html \ -H aux/workflow/favicon.html \ - -H aux/workflow/style.css \ - | \ - perl -pe "$TODOS_CLEANUP_REGEX1" | \ - perl -pe "$TODOS_CLEANUP_REGEX2" \ + -H aux/workflow/style.css | + sed \ + -e 's:<a><a:<a:g' \ + -e 's:</a></a>:</a>:g' \ > "$OUTDIR/TODOs.html" diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh index 7f9117f..ca86407 100755 --- a/aux/workflow/assert-changelog.sh +++ b/aux/workflow/assert-changelog.sh @@ -43,8 +43,9 @@ assert() { DATE="$1" VVERSION="$2" VERSION="${2#v}" - CHANGELOG_ENTRY="# [$VERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) - $DATE" - + 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 diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh index 843fd86..dbe657e 100755 --- a/aux/workflow/assert-readme.sh +++ b/aux/workflow/assert-readme.sh @@ -44,7 +44,8 @@ and for generating the documentation HTML and website, run: $ make public \`\`\` -Send contributions to the [mailing list] via [\`git send-email\`](https://git-send-email.io/). +Send contributions to the [mailing list] via +[\`git send-email\`](https://git-send-email.io/). ## Links @@ -89,7 +90,9 @@ cat <<EOF >> "$EXPECTED" ## License -The code is licensed under [GNU Affero General Public License v3.0 or later][AGPL-3.0-or-later] (AGPL-3.0-or-later). +The code is licensed under +[GNU Affero General Public License v3.0 or later][AGPL-3.0-or-later] +(AGPL-3.0-or-later). [AGPL-3.0-or-later]: https://git.euandreh.xyz/$PROJECT/tree/COPYING EOF diff --git a/aux/workflow/assert-todos.sh b/aux/workflow/assert-todos.sh index dfa1ab7..c21ebb9 100755 --- a/aux/workflow/assert-todos.sh +++ b/aux/workflow/assert-todos.sh @@ -1,7 +1,8 @@ #!/bin/sh set -eu -if git grep FIXME | grep -v '^TODOs.md' | grep -v '^aux/workflow/assert-todos.sh'; then +if git grep FIXME | grep -v '^TODOs.md' | + grep -v '^aux/workflow/assert-todos.sh'; then echo "Found dangling FIXME markers on the project." echo "You should write them down properly on TODOs.md." exit 1 diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh index b196867..6f5e59b 100755 --- a/aux/workflow/commonmark.sh +++ b/aux/workflow/commonmark.sh @@ -1,21 +1,15 @@ #!/bin/sh set -eu -while getopts 'N:o:r:w:L:' flag; do +while getopts 'N:t:l:' flag; do case "$flag" in N) PROJECT_UC="$OPTARG" ;; - o) - OUTDIR="$OPTARG" + t) + TITLE="$OPTARG" ;; - r) - IN_FILE="$OPTARG" - ;; - w) - OUT_FILE="$OPTARG" - ;; - L) + l) THE_LANG="$OPTARG" ;; *) @@ -33,25 +27,16 @@ assert_arg() { } assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC' -assert_arg "${OUTDIR:-}" '-o OUTDIR' -assert_arg "${IN_FILE:-}" '-i IN_FILE' -assert_arg "${THE_LANG:-}" '-L THE_LANG' - -if [ -z "${OUT_FILE:-}" ]; then - OUT_FILE="${IN_FILE%.md}.html" -fi - -OUT="$OUTDIR/$OUT_FILE" -mkdir -p "$(dirname "$OUT")" +assert_arg "${TITLE:-}" '-t TITLE' +assert_arg "${THE_LANG:-}" '-l THE_LANG' pandoc \ - --toc \ - --highlight-style pygments \ - --toc-depth=2 \ - -s \ - --metadata title="$PROJECT_UC - ${IN_FILE%%.*}" \ - --metadata "lang=$THE_LANG" \ - -r commonmark \ - -w html \ - -H aux/workflow/favicon.html \ - < "$IN_FILE" > "$OUT" + --toc \ + --highlight-style pygments \ + --toc-depth=2 \ + -s \ + --metadata title="$PROJECT_UC - $TITLE" \ + --metadata "lang=$THE_LANG" \ + -r commonmark \ + -w html \ + -H aux/workflow/favicon.html diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh index be32ac1..07be9d4 100755 --- a/aux/workflow/public.sh +++ b/aux/workflow/public.sh @@ -33,30 +33,27 @@ assert_arg() { 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 +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' +assert_arg "${OUTDIR:-}" '-o OUTDIR' +assert_arg "${LANGS:-}" '-l LANGS' +PROJECT_UC="${PROJECT_UC:-$PROJECT}" 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/workflow/TODOs.sh \ + -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR" -sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR" +for lang in $LANGS; do + mkdir -p "$OUTDIR/$lang/" + sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" \ + < "README.$lang.md" > "$OUTDIR/$lang/index.html" + sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" \ + < "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html" + cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR/$lang" +done + +ln -fs en/index.html "$OUTDIR/index.html" cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR" + +sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR" diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh index 168d38d..3ab2bb8 100755 --- a/aux/workflow/sign-tarballs.sh +++ b/aux/workflow/sign-tarballs.sh @@ -26,12 +26,13 @@ assert_arg "${PROJECT:-}" '-n PROJECT' SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)" for tag in $(git tag); do COMMIT="$(git rev-list -n1 "$tag")" - if ! echo "$SIGNATURES" | grep -qF "$COMMIT"; then - echo "Adding missing signature to $tag" >&2 - git notes --ref=refs/notes/signatures/tar.gz add -f -C "$( - git archive --format tar.gz --prefix "$PROJECT-${tag#v}/" "$tag" | - gpg --output - --armor --detach-sign | - git hash-object -w --stdin - )" "$tag" + if echo "$SIGNATURES" | grep -qF "$COMMIT"; then + continue fi + echo "Adding missing signature to $tag" >&2 + git notes --ref=refs/notes/signatures/tar.gz add -C "$( + git archive --format tar.gz --prefix "$PROJECT-$tag/" "$tag" | + gpg --output - --armor --detach-sign | + git hash-object -w --stdin + )" "$tag" done |