34 lines
713 B
Bash
Executable file
34 lines
713 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
[ -n "$DEBUG" ] && set -x
|
|
|
|
echo "👀 Fetching git repository information…"
|
|
git fetch origin --quiet
|
|
|
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
CURRENT_HEAD=$(git rev-parse HEAD)
|
|
ORIGIN_HEAD=$(git rev-parse origin/main)
|
|
|
|
if [ "main" != "${CURRENT_BRANCH}" ]; then
|
|
echo "😕 Only main can be deployed to production"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "${CURRENT_HEAD}" != "${ORIGIN_HEAD}" ]; then
|
|
echo "😕 Local main is not up to date with origin"
|
|
exit 1
|
|
fi
|
|
|
|
read -r -p "👉 Deploy main to production ? (y/N) " confirmed
|
|
|
|
if [ "${confirmed}" != "y" ]; then
|
|
echo "😞 Abort, bye."
|
|
exit 1
|
|
fi
|
|
|
|
echo "🚀 Deploying main to production !"
|
|
bundle exec cap production deploy
|
|
|
|
echo "😎 Done !"
|