diff options
Diffstat (limited to 'deploy/deploy.sh')
-rwxr-xr-x | deploy/deploy.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 4650ccf..d684b38 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh die() { >&2 echo "error: $@" @@ -7,18 +7,18 @@ die() { set -e -DIR="$( cd "$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )" && pwd )" +DIR=$(cd "$(dirname "$(readlink -f "$0")")" && pwd) DEV_DIR="$(realpath "$DIR/../")" STAGING_DIR="$HOME/staging" -PROD_DIR="$HOME/prod" -PHP=/usr/bin/php8.1 +PROD_DIR="$HOME/www" +PHP="$(which php)" REPO_URI=$(cat "$DEV_DIR/config.yaml" | grep ^git_repo | head -1 | awk '{print $2}') git push origin master [ -d "$STAGING_DIR" ] || mkdir "$STAGING_DIR" -pushd "$STAGING_DIR" +cd "$STAGING_DIR" if [ ! -d .git ]; then git init @@ -30,7 +30,7 @@ fi git reset --hard git pull origin master -composer8.1 install --no-dev --optimize-autoloader --ignore-platform-reqs +composer install --no-dev --optimize-autoloader --ignore-platform-reqs if [ ! -d node_modules ]; then npm i @@ -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" $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 rsync -a --delete --delete-excluded --info=progress2 "$STAGING_DIR/" "$PROD_DIR/" \ @@ -55,4 +55,4 @@ rsync -a --delete --delete-excluded --info=progress2 "$STAGING_DIR/" "$PROD_DIR/ --exclude='/htdocs/sass.php' \ --exclude='/htdocs/js.php' \ --exclude='*.sh' \ - --exclude='*.sql' + --exclude='*.sql'
\ No newline at end of file |