aboutsummaryrefslogtreecommitdiff
path: root/aux
diff options
context:
space:
mode:
Diffstat (limited to 'aux')
-rwxr-xr-xaux/workflow/TODOs.sh11
-rwxr-xr-xaux/workflow/assert-changelog.sh21
-rwxr-xr-xaux/workflow/assert-readme.sh33
-rwxr-xr-xaux/workflow/dist.sh9
4 files changed, 62 insertions, 12 deletions
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index 80059ee..9f9f657 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -8,7 +8,9 @@ PROJECT="$2"
MAILING_LIST="$3"
TLD="$(cat aux/tld.txt)"
-TODOS_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\n<span class="header-anchor" id="\3">#\3<\/span>\n/'
+TODOS_ADD_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\n<span class="header-anchor" id="\3">#\3<\/span>\n/'
+TODOS_CLEANUP_REGEX1='s/(<a><a)/<a/'
+TODOS_CLEANUP_REGEX2='s/<\/a><\/a>/<\/a>/'
TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g'
@@ -20,7 +22,7 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
printf \
'%s\n\n%s' \
"$(cat -)" \
- "$(perl -pe "$TODOS_REGEX" TODOs.md | perl -pe "$TAGS_REGEX")" | \
+ "$(perl -pe "$TODOS_ADD_REGEX" TODOs.md | perl -pe "$TAGS_REGEX")" | \
pandoc \
--toc \
--highlight-style pygments \
@@ -32,4 +34,7 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
-w html \
-H aux/workflow/favicon.html \
-H aux/workflow/style.css \
- > public/TODOs.html
+ | \
+ perl -pe "$TODOS_CLEANUP_REGEX1" | \
+ perl -pe "$TODOS_CLEANUP_REGEX2" \
+ > public/TODOs.html
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 8e81f1f..bef610b 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -2,13 +2,28 @@
set -eu
PROJECT="$1"
+shift
-for VVERSION in $(git tag); do
- VERSION="${VVERSION#v}"
- DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
+assert() {
+ DATE="$1"
+ VVERSION="$2"
+ VERSION="${2#v}"
CHANGELOG_ENTRY="# [$VERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) - $DATE"
+
if ! grep -qF "$CHANGELOG_ENTRY" CHANGELOG.md; then
echo "Missing '$CHANGELOG_ENTRY' entry from CHANGELOG.md" >&2
exit 1
fi
+}
+
+for VVERSION in $(git tag); do
+ DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
+ assert "$DATE" "$VVERSION"
+done
+
+# "$@" represents a list of tags to be also included in the verification.
+# shellcheck disable=2068
+for VVERSION in $@; do
+ DATE="$(date '+%Y-%m-%d')"
+ assert "$DATE" "$VVERSION"
done
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index 77e9ead..966ec3b 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -5,6 +5,8 @@ mkdir -p public
PROJECT="$1"
MAILING_LIST="$2"
+shift
+shift
TLD="$(cat aux/tld.txt)"
EXPECTED="$(mktemp)"
@@ -22,25 +24,45 @@ 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/).
+
## Links
- [home page](https://$TLD/$PROJECT/)
- [source code](https://git.euandreh.xyz/$PROJECT/)
- [bug tracking](https://$TLD/$PROJECT/TODOs.html)
-- [mailing list](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D)
+- [mailing list]
- [CI logs](https://$TLD/$PROJECT/ci.html)
- [CHANGELOG](https://$TLD/$PROJECT/CHANGELOG.html)
+
+[mailing list]: https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D
EOF
RELEASES_LIST="$(mktemp)"
-for version in $(git tag | perl -e 'print reverse <>'); do
- echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz.asc)), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST"
+add_release() {
+ DATE="$1"
+ VVERSION="$2"
+ echo "- version [$VVERSION](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz.asc)), released in $DATE" >> "$RELEASES_LIST"
+}
+
+for VVERSION in $(git tag); do
+ DATE="$(git log -1 --format=%cd --date=short "$VVERSION")"
+ add_release "$DATE" "$VVERSION"
+done
+
+# "$@" represents a list of tags to be also included in the verification.
+# shellcheck disable=2068
+for VVERSION in $@; do
+ if ! git tag | grep -qF "$VVERSION"; then
+ DATE="$(date '+%Y-%m-%d')"
+ add_release "$DATE" "$VVERSION"
+ fi
done
if [ -s "$RELEASES_LIST" ]; then
printf '\n\n## Releases\n\n' >> "$EXPECTED"
- cat "$RELEASES_LIST" >> "$EXPECTED"
+ sort -r "$RELEASES_LIST" >> "$EXPECTED"
fi
cat <<EOF >> "$EXPECTED"
@@ -54,6 +76,7 @@ The code is licensed under [GNU Affero General Public License v3.0 or later][AGP
EOF
if ! tail -n "$(wc -l < "$EXPECTED")" README.md | diff - "$EXPECTED"; then
- echo 'Missing metadata at the end of README.md file'
+ echo 'Wrong metadata at the end of README.md file'
+ echo "See expected content at: $EXPECTED"
exit 1
fi
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index c061a04..d0d3e02 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -4,12 +4,16 @@ set -eu
DATE="$1"
VVERSION="v$2"
PROJECT="$3"
+MAILING_LIST="$4"
if git show "$VVERSION" 1>/dev/null 2>/dev/null; then
echo "Version '$VVERSION' already exists." >&2
exit 1
fi
+sh aux/workflow/assert-changelog.sh "$PROJECT" "$VVERSION"
+sh aux/workflow/assert-readme.sh "$PROJECT" "$MAILING_LIST" "$VVERSION"
+
if [ "$DATE" != "$(git log -1 --format=%cd --date=short HEAD)" ]; then
echo "Date '$DATE' is not up-to-date." >&2
exit 1
@@ -20,7 +24,10 @@ if [ "Release $VVERSION" != "$(git log --format=%B -1 HEAD | head -n1)" ]; then
exit 1
fi
-sh aux/workflow/assert-changelog.sh "$PROJECT"
+if ! (git diff --quiet && git diff --quiet --staged); then
+ echo 'Dirty repository.'
+ exit 1
+fi
git tag "$VVERSION"