Add check for current tag

This commit is contained in:
Antonio J. Delgado 2024-02-16 17:59:39 +02:00
parent d1f54072d4
commit f23f051c0d

View file

@ -91,6 +91,8 @@ if [ "${DEBUG}" == "true" ]; then
echo "Changing to Mastodon's home directory '${mastodon_home}'..." echo "Changing to Mastodon's home directory '${mastodon_home}'..."
fi fi
cd "${mastodon_home}" || exit 3 cd "${mastodon_home}" || exit 3
current_tag=$(git name-rev --name-only HEAD | awk 'BEGIN {FS="/"} {print($2)}')
if [ "${current_tag}" != "${tag}" ]; then
if [ "${DEBUG}" == "true" ]; then if [ "${DEBUG}" == "true" ]; then
echo "Fetching from repository..." echo "Fetching from repository..."
fi fi
@ -122,3 +124,7 @@ if [ "${DEBUG}" == "true" ]; then
echo "Restarting Mastodon services..." echo "Restarting Mastodon services..."
fi fi
"${pre_command}"sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service "${pre_command}"sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service
else
echo "Current branch is already '${tag}'"
exit 0
fi