Improve build script

This commit is contained in:
Christoph Hagen 2023-09-07 17:37:30 +02:00
parent f84dee72c0
commit bf6f1b3339

View File

@ -1,13 +1,31 @@
supervisor_name=schafkopf
echo "[1/7] Stopping server..."
sudo supervisorctl stop schafkopf
sudo supervisorctl stop supervisor_name
echo "[2/7] Changing permissions..."
sudo chown -R pi:pi .
if ! sudo chown -R pi:pi .; then
exit 0
fi
echo "[3/7] Pulling changes..."
git pull
if ! git pull; then
exit 0
fi
echo "[4/7] Building project..."
swift build -c release
if ! swift build -c release; then
exit 0
fi
echo "[5/7] Restoring permissions..."
sudo chown -R www-data:www-data .
if ! sudo chown -R www-data:www-data .; then
exit 0
fi
echo "[6/7] Starting server..."
sudo supervisorctl start schafkopf
if ! sudo supervisorctl start $supervisor_name; then
exit 0
fi
echo "[7/7] Done"