aboutsummaryrefslogblamecommitdiff
path: root/aux/workflow/assert-readme.sh
blob: 2e5d9789fb258c1e97f01bbb6d149f24ded11097 (plain) (tree)
1
2
3
4
5
6
7
8
9






                 

     
















                                                           

                                                                                              


        
                                    

                                                   
                

                                                   

                                                                                 


                         

















                                                                                                                                                                                                                                   



                                                   
                                               








                                                                                                                    
                                                                   


                                                                          

                                                          

              
#!/bin/sh
set -eu

mkdir -p public

PROJECT="$1"
MAILING_LIST="$2"
shift
shift
TLD="$(cat aux/tld.txt)"

EXPECTED="$(mktemp)"
cat <<EOF >> "$EXPECTED"

For running the extra development-only checks, run:

\`\`\`shell
$ make dev-check
\`\`\`

and for generating the documentation HTML and website, run:

\`\`\`shell
$ make public
\`\`\`

Send contributions to the [mailing list] via [\`git send-email\`](https://git-send-email.io/).


## Links

- [homepage](https://$TLD/$PROJECT/)
- [source code](https://git.euandreh.xyz/$PROJECT/)
- [bug tracking](https://$TLD/$PROJECT/TODOs.html)
- [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)"
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"
	sort -r "$RELEASES_LIST" >> "$EXPECTED"
fi

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).

[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 'Wrong metadata at the end of README.md file'
	echo "See expected content at: $EXPECTED"
	exit 1
fi