-
-
Save testfailed/8a1950a51005c1b2406daada1e4302a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# set -euo pipefail | |
# IFS=$'\n\t' | |
function deploy() { | |
# zero downtime deployment nextjs without vercel | |
echo "Deploy starting..." | |
git pull | |
yarn install || exit | |
BUILD_DIR=temp yarn build || exit | |
if [ ! -d "temp" ]; then | |
echo '\033[31m directory "temp" does not exists!\033[0m' | |
exit 1; | |
fi | |
rm -rf .next | |
mv temp .next | |
pm2 reload ecosystem.config.production.js --update-env | |
echo "Deploy done!" | |
# make sure `next.config.js` it set `distDir: process.env.BUILD_DIR` | |
} | |
deploy "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment