diff options
-rwxr-xr-x | aux/assert-shellcheck.sh | 2 | ||||
-rwxr-xr-x | aux/ci/ci-build.sh | 23 | ||||
-rwxr-xr-x | aux/ci/git-post-receive.sh | 13 | ||||
-rwxr-xr-x | aux/ci/git-pre-push.sh | 9 | ||||
-rwxr-xr-x | aux/ci/report.sh | 45 | ||||
-rwxr-xr-x | aux/guix/with-container.sh | 2 | ||||
-rwxr-xr-x | aux/lib.sh | 30 | ||||
-rwxr-xr-x | aux/workflow/TODOs.sh | 72 | ||||
-rwxr-xr-x | aux/workflow/assert-changelog.sh | 57 | ||||
-rwxr-xr-x | aux/workflow/assert-readme.sh | 70 | ||||
-rwxr-xr-x | aux/workflow/assert-todos.sh | 4 | ||||
-rwxr-xr-x | aux/workflow/commonmark.sh | 50 | ||||
-rwxr-xr-x | aux/workflow/dist.sh | 63 | ||||
-rw-r--r-- | aux/workflow/preamble.md | 6 | ||||
-rwxr-xr-x | aux/workflow/public.sh | 60 | ||||
-rwxr-xr-x | aux/workflow/sign-tarballs.sh | 28 | ||||
-rw-r--r-- | aux/workflow/style.css | 83 |
17 files changed, 471 insertions, 146 deletions
diff --git a/aux/assert-shellcheck.sh b/aux/assert-shellcheck.sh index cc01f3a..1779ea8 100755 --- a/aux/assert-shellcheck.sh +++ b/aux/assert-shellcheck.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -eux +set -eu git ls-files | \ xargs awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | \ diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh index b6769a9..17e9e37 100755 --- a/aux/ci/ci-build.sh +++ b/aux/ci/ci-build.sh @@ -1,12 +1,19 @@ #!/bin/sh set -eux -PACKAGE="$1" +PROJECT="$1" LOGS_DIR="$2" -read -r _ SHA _ # oldrev newrev refname +SHA="$3" FILENAME="$(date -Is)-$SHA.log" LOGFILE="$LOGS_DIR/$FILENAME" +mkdtemp() { + name="$(echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")" + rm -f "$name" + mkdir "$name" + echo "$name" +} + { echo "Starting CI job at: $(date -Is)" @@ -26,24 +33,24 @@ EOF git notes append -m "$NOTE" cd - - sh aux/ci/report.sh "$PACKAGE" - rsync -a public/ "/srv/http/$PACKAGE/" --delete + git fetch origin refs/notes/*:refs/notes/* + sh aux/ci/report.sh -n "$PROJECT" -o public + rsync -av public/ "/srv/http/$PROJECT/" --delete - printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS" + printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s\n\n" "$STATUS" } trap finish EXIT unset GIT_DIR REMOTE="$PWD" - cd "$(mktemp -d)" + cd "$(mkdtemp)" git clone "$REMOTE" . git config --global user.email git@euandre.org git config --global user.name 'EuAndreh CI' - git fetch origin refs/notes/*:refs/notes/* git annex get ||: if [ -f aux/guix/with-container.sh ]; then - RUNNER='./aux/guix/with-container.sh' + RUNNER='sh aux/guix/with-container.sh' else RUNNER='sh -c' fi diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh index ee8075f..426bff3 100755 --- a/aux/ci/git-post-receive.sh +++ b/aux/ci/git-post-receive.sh @@ -9,6 +9,13 @@ for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do fi done -PACKAGE="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix -LOGS_DIR="/opt/ci/$PACKAGE/logs" -"/opt/ci/$PACKAGE/ci-build.sh" "$PACKAGE" "$LOGS_DIR" +# shellcheck disable=2034 +read -r _oldrev SHA _refname + +PROJECT="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix +LOGS_DIR="/opt/ci/$PROJECT/logs" +sh "/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA" ||: + +echo 'To retrigger the build, run:' +echo "cd /srv/http/$PROJECT.git/" +echo "sh /opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA" diff --git a/aux/ci/git-pre-push.sh b/aux/ci/git-pre-push.sh index e73b9b8..eaaa7bd 100755 --- a/aux/ci/git-pre-push.sh +++ b/aux/ci/git-pre-push.sh @@ -2,12 +2,13 @@ set -eux TLD="$(cat aux/tld.txt)" +. aux/lib.sh -PACKAGE="$(basename "$PWD")" -LOGS_DIR="/opt/ci/$PACKAGE/logs" -REMOTE_GIT_DIR="/srv/git/$PACKAGE.git" +PROJECT="$(basename "$PWD")" +LOGS_DIR="/opt/ci/$PROJECT/logs" +REMOTE_GIT_DIR="/srv/http/$PROJECT.git" -DESCRIPTION="$(mktemp)" +DESCRIPTION="$(mkstemp)" if [ -f description ] then cp description "$DESCRIPTION" diff --git a/aux/ci/report.sh b/aux/ci/report.sh index 65d3335..1aa41a0 100755 --- a/aux/ci/report.sh +++ b/aux/ci/report.sh @@ -1,23 +1,47 @@ #!/bin/sh set -eu -PROJECT_UC="$1" +TLD="$(cat aux/tld.txt)" +. aux/lib.sh + +while getopts 'n:o:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + o) + OUTDIR="$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 "${OUTDIR:-}" '-o OUTDIR' PASS='✅' FAIL='❌' -mkdir -p public/ci-logs public/ci-data +mkdir -p "$OUTDIR/ci-logs" "$OUTDIR/ci-data" -OUT="$(mktemp)" +OUT="$(mkstemp)" chmod 644 "$OUT" -git fetch origin refs/notes/*:refs/notes/* ||: - for c in $(git notes list | cut -d\ -f2); do DATA="$(git notes --ref=refs/notes/ci-data show "$c")" FILENAME="$(echo "$DATA" | cut -d\ -f2)" - echo "$DATA" > "public/ci-data/$FILENAME" - git notes --ref=refs/notes/ci-logs show "$c" > "public/ci-logs/$FILENAME" + echo "$DATA" > "$OUTDIR/ci-data/$FILENAME" + git notes --ref=refs/notes/ci-logs show "$c" > "$OUTDIR/ci-logs/$FILENAME" done cat <<EOF >> "$OUT" @@ -27,6 +51,7 @@ cat <<EOF >> "$OUT" <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="icon" type="image/svg+xml" href="favicon.svg" /> + <title>CI logs for $PROJECT</title> <style> pre { @@ -36,12 +61,12 @@ cat <<EOF >> "$OUT" </head> <body> <h1> - CI logs for $PROJECT_UC + CI logs for <a href="https://$TLD/$PROJECT/en/">$PROJECT</a> </h1> <ul> EOF -for f in $(find public/ci-data/ -type f | LANG=C.UTF-8 sort -r); do +for f in $(find "$OUTDIR/ci-data/" -type f | LANG=C.UTF-8 sort -r); do DATA="$(cat "$f")" STATUS="$(echo "$DATA" | cut -d\ -f1)" FILENAME="$(echo "$DATA" | cut -d\ -f2)" @@ -67,4 +92,4 @@ cat <<EOF >> "$OUT" </html> EOF -mv "$OUT" public/ci.html +mv "$OUT" "$OUTDIR/ci.html" diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh index b521c82..408fb39 100755 --- a/aux/guix/with-container.sh +++ b/aux/guix/with-container.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -eux +set -eu if [ -z "${1:-}" ]; then guix time-machine --fallback -C aux/guix/pinned-channels.scm -- \ diff --git a/aux/lib.sh b/aux/lib.sh new file mode 100755 index 0000000..c31c4fb --- /dev/null +++ b/aux/lib.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# +# Generally, utilities that I expected to exist in POSIX, but don't. +# + +uuid() { + # Taken from: + # https://serverfault.com/a/799198 + od -xN20 /dev/urandom | \ + head -1 | \ + awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' +} + +tmpname() { + echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname." +} + +mkstemp() { + name="$(tmpname)" + touch "$name" + echo "$name" +} + +mkdtemp() { + name="$(tmpname)" + rm -f "$name" + mkdir "$name" + echo "$name" +} diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh index 80059ee..d875e0e 100755 --- a/aux/workflow/TODOs.sh +++ b/aux/workflow/TODOs.sh @@ -1,26 +1,59 @@ #!/bin/sh set -eu -mkdir -p public - -PROJECT_UC="$1" -PROJECT="$2" -MAILING_LIST="$3" TLD="$(cat aux/tld.txt)" +PROJECT_UC= +while getopts 'n:N:m:o:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + N) + PROJECT_UC="$OPTARG" + ;; + m) + MAILING_LIST="$OPTARG" + ;; + o) + OUTDIR="$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 -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/' -TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g' +# 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' -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%s' \ - "$(cat -)" \ - "$(perl -pe "$TODOS_REGEX" TODOs.md | perl -pe "$TAGS_REGEX")" | \ +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 \ @@ -31,5 +64,8 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \ -r commonmark \ -w html \ -H aux/workflow/favicon.html \ - -H aux/workflow/style.css \ - > public/TODOs.html + -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 8e81f1f..7f9117f 100755 --- a/aux/workflow/assert-changelog.sh +++ b/aux/workflow/assert-changelog.sh @@ -1,14 +1,63 @@ #!/bin/sh set -eu -PROJECT="$1" +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)) -for VVERSION in $(git tag); do - VERSION="${VVERSION#v}" - DATE="$(git log -1 --format=%cd --date=short "$VVERSION")" +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="# [$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. +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 cef75dd..333a753 100755 --- a/aux/workflow/assert-readme.sh +++ b/aux/workflow/assert-readme.sh @@ -1,13 +1,35 @@ #!/bin/sh set -eu -mkdir -p public - -PROJECT="$1" -MAILING_LIST="$2" TLD="$(cat aux/tld.txt)" +. aux/lib.sh + +while getopts 'n:m:' flag; do + case "$flag" in + n) + PROJECT="$OPTARG" + ;; + m) + MAILING_LIST="$OPTARG" + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} -EXPECTED="$(mktemp)" +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' + +EXPECTED="$(mkstemp)" cat <<EOF >> "$EXPECTED" For running the extra development-only checks, run: @@ -22,25 +44,44 @@ 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/) +- [homepage](https://$TLD/$PROJECT/en/) - [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) +- [CHANGELOG](https://$TLD/$PROJECT/en/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" +RELEASES_LIST="$(mkstemp)" +add_release() { + DATE="$1" + VVERSION="$2" + echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.xz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz.asc)) - $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. +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" @@ -50,10 +91,11 @@ cat <<EOF >> "$EXPECTED" 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://www.gnu.org/licenses/agpl-3.0.en.html +[AGPL-3.0-or-later]: https://git.euandreh.xyz/$PROJECT/tree/COPYING 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/assert-todos.sh b/aux/workflow/assert-todos.sh index ca73b7f..dfa1ab7 100755 --- a/aux/workflow/assert-todos.sh +++ b/aux/workflow/assert-todos.sh @@ -29,8 +29,8 @@ h2flag == 1 { h2flag = 0 } -/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE)/ { - if (match($0, / \{#.*?\}$/) == 0) { +/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX)/ { + if (match($0, / \{#.*?\}.*$/) == 0) { print "Missing ID for line " NR ":\n" $0 exitstatus = 1 } diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh index 6016f51..6f5e59b 100755 --- a/aux/workflow/commonmark.sh +++ b/aux/workflow/commonmark.sh @@ -1,20 +1,42 @@ #!/bin/sh set -eu -mkdir -p public +while getopts 'N:t:l:' flag; do + case "$flag" in + N) + PROJECT_UC="$OPTARG" + ;; + t) + TITLE="$OPTARG" + ;; + l) + THE_LANG="$OPTARG" + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) -PROJECT_UC="$1" -F="$2" -OUT="${3:-${F%.*}.html}" +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} + +assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC' +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 - ${F%.*}" \ - --metadata lang=en \ - -r commonmark \ - -w html \ - -H aux/workflow/favicon.html \ - < "$F" > "public/$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/dist.sh b/aux/workflow/dist.sh index c061a04..15593f4 100755 --- a/aux/workflow/dist.sh +++ b/aux/workflow/dist.sh @@ -1,15 +1,55 @@ #!/bin/sh set -eu -DATE="$1" -VVERSION="v$2" -PROJECT="$3" +PROJECT_UC= +while getopts 'd:V:n:N:m:' flag; do + case "$flag" in + d) + DATE="$OPTARG" + ;; + V) + VVERSION="v$OPTARG" + ;; + n) + PROJECT="$OPTARG" + ;; + N) + PROJECT_UC="$OPTARG" + ;; + m) + MAILING_LIST="$OPTARG" + ;; + *) + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} + +assert_arg "${DATE:-}" '-d DATE' +assert_arg "${VVERSION:-}" '-V VERSION' +assert_arg "${PROJECT:-}" '-n PROJECT' +assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' + +if [ -z "${PROJECT_UC:-}" ]; then + PROJECT_UC="$PROJECT" +fi 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 -N "$PROJECT_UC" -n "$PROJECT" "$VVERSION" +sh aux/workflow/assert-readme.sh -n "$PROJECT" -m "$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,8 +60,21 @@ 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" -sh aux/workflow/sign-tarballs.sh "$PROJECT" +sh aux/workflow/sign-tarballs.sh -n "$PROJECT" + + +cat <<EOF >&2 +Now push the tag and the signature before pushing the commit: + +git push origin refs/notes/signatures/tar.xz -o skip-ci --no-verify +git push --tags -o skip-ci --no-verify +git push + +EOF diff --git a/aux/workflow/preamble.md b/aux/workflow/preamble.md index 30efe0b..ee32d58 100644 --- a/aux/workflow/preamble.md +++ b/aux/workflow/preamble.md @@ -1,11 +1,9 @@ # About -TODOs for @PROJECT_UC@. - -See also [@TLD@/@PROJECT@/](https://@TLD@/@PROJECT@/) and [CI logs](https://@TLD@/@PROJECT@/ci.html). +TODOs for [@PROJECT_UC@](https://@TLD@/@PROJECT@/en/). Register a new one at -[~euandreh/@MAILING_LIST@@lists.sr.ht](mailto:~euandreh/@MAILING_LIST@@lists.sr.ht?subject=%5B@PROJECT@%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E) +<span id="new">[~euandreh/@MAILING_LIST@@lists.sr.ht](mailto:~euandreh/@MAILING_LIST@@lists.sr.ht?subject=%5B@PROJECT@%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E)</span> and see [existing discussions](https://lists.sr.ht/~euandreh/@MAILING_LIST@?search=%5B@PROJECT@%5D). *Você também pode escrever em português*. diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh index 8ecb855..f9f3b3d 100755 --- a/aux/workflow/public.sh +++ b/aux/workflow/public.sh @@ -1,17 +1,57 @@ #!/bin/sh set -eu -PROJECT_UC="$1" -PROJECT="$2" -MAILING_LIST="$3" +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)) -sh aux/workflow/TODOs.sh "$PROJECT_UC" "$PROJECT" "$MAILING_LIST" -sh aux/workflow/commonmark.sh "$PROJECT" README.md index.html ||: +assert_arg() { + if [ -z "$1" ]; then + echo "Missing $2" >&2 + exit 2 + fi +} -if [ -f CHANGELOG.md ]; then - sh aux/workflow/commonmark.sh "$PROJECT" CHANGELOG.md -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}" -sh aux/ci/report.sh "$PROJECT" +mkdir -p "$OUTDIR" -cp aux/workflow/favicon.* public/ +sh aux/workflow/TODOs.sh -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -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" +ln -fs en/CHANGELOG.html "$OUTDIR/CHANGELOG.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 8de6ac4..3775e28 100755 --- a/aux/workflow/sign-tarballs.sh +++ b/aux/workflow/sign-tarballs.sh @@ -1,15 +1,35 @@ #!/bin/sh set -eu -PROJECT="$1" +while getopts 'n:' flag; do + case "$flag" in + n) + PROJECT="$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' + -SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)" +SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.xz 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" | + git notes --ref=refs/notes/signatures/tar.xz add -C "$( + git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" | gpg --output - --armor --detach-sign | git hash-object -w --stdin )" "$tag" diff --git a/aux/workflow/style.css b/aux/workflow/style.css index d7935d0..d72991e 100644 --- a/aux/workflow/style.css +++ b/aux/workflow/style.css @@ -1,46 +1,41 @@ <style> - hr { - background-color: #ccc; - } - - div.header-anchor { - opacity: 0.5; - } - - span.tag { - font-family: monospace; - font-size: 70%; - background-color: lightgray; - padding: 3px; - border-radius: 5px; - } - - /* - Replicate colors from: - https://git.euandreh.xyz/dotfiles/tree/spacemacs.el?id=fcd9f9c4ef399d45d54927382dc1cdde251ebb0a#n866 - */ - - .TODO { - color: brown; - } - - .DOING { - color: yellowgreen; - } - - .WAITING, .MEETING { - color: gray; - } - - .INACTIVE { - color: orange; - } - - .NEXT { - color: red; - } - - .CANCELLED, .DONE { - color: green; - } + hr { + background-color: #ccc; + } + + .header-anchor { + opacity: 0.5; + } + + .tag { + font-family: monospace; + font-size: 70%; + background-color: lightgray; + padding: 3px; + border-radius: 5px; + } + + .TODO { + color: brown; + } + + .DOING { + color: yellowgreen; + } + + .WAITING, .MEETING { + color: orange; + } + + .INACTIVE { + color: gray; + } + + .NEXT { + color: red; + } + + .CANCELLED, .DONE, .WONTFIX { + color: green; + } </style> |