deploy/deploy.sh: more bash/sh fixes

This commit is contained in:
E. S. 2024-07-28 21:57:29 +03:00
parent ea0fc2b459
commit a111eb7f1a

View File

@ -12,13 +12,13 @@ DIR=$(cd "$(dirname "$(readlink -f "$0")")" && pwd)
DEV_DIR="$(realpath "$DIR/../")" DEV_DIR="$(realpath "$DIR/../")"
STAGING_DIR="$HOME/staging" STAGING_DIR="$HOME/staging"
PROD_DIR="$HOME/www" PROD_DIR="$HOME/www"
PHP=/usr/bin/php PHP="$(which php)"
REPO_URI=$(cat "$DEV_DIR/config.yaml" | grep ^git_repo | head -1 | awk '{print $2}') REPO_URI=$(cat "$DEV_DIR/config.yaml" | grep ^git_repo | head -1 | awk '{print $2}')
git push origin master git push origin master
[ -d "$STAGING_DIR" ] || mkdir "$STAGING_DIR" [ -d "$STAGING_DIR" ] || mkdir "$STAGING_DIR"
pushd "$STAGING_DIR" cd "$STAGING_DIR"
if [ ! -d .git ]; then if [ ! -d .git ]; then
git init git init
@ -42,7 +42,7 @@ cp "$DEV_DIR/config.yaml" .
"$DIR"/build_css.sh -i "$DEV_DIR/htdocs/scss" -o "$STAGING_DIR/htdocs/dist-css" || die "build_css failed" "$DIR"/build_css.sh -i "$DEV_DIR/htdocs/scss" -o "$STAGING_DIR/htdocs/dist-css" || die "build_css failed"
$PHP "$DIR"/gen_static_config.php -i "$STAGING_DIR/htdocs" > "$STAGING_DIR/config-static.php" || die "gen_static_config failed" $PHP "$DIR"/gen_static_config.php -i "$STAGING_DIR/htdocs" > "$STAGING_DIR/config-static.php" || die "gen_static_config failed"
popd cd "$DIR"
# copy staging to prod # copy staging to prod
rsync -a --delete --delete-excluded --info=progress2 "$STAGING_DIR/" "$PROD_DIR/" \ rsync -a --delete --delete-excluded --info=progress2 "$STAGING_DIR/" "$PROD_DIR/" \