Ensure that scr/version is up-to-date when building

This is an experiment to see if it forces me to actually have updated
the version before I build. The idea is that I need to actually commit
the version which will make it more likely that all instances can pull
down the code and display the correct version if I've done it myself.

It uses `git show` to grab the committed contents of src/version then
checks to see if it matches today's date.
main
Edward Loveall 2022-01-15 16:31:02 -05:00
rodzic c775072b3d
commit 27234bd32a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A7606DFEC2BA731F
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -4,4 +4,14 @@
set -e
set -o pipefail
todays_date=$(date "+%Y-%m-%d")
if ! git show HEAD:src/version.cr | rg -q $todays_date; then
echo "Date in committed src/version.cr is not today's date ($todays_date)"
echo "Make sure that the file is both up to date and commited to git."
echo
echo "## src/version.cr"
git show HEAD:src/version.cr
exit 1
fi
crystal build src/start_server.cr -o ubuntu_server --release --cross-compile --target "x86_64-pc-linux-gnu"