From 8804b9c075b95c113806fab1866b4071dc49130d Mon Sep 17 00:00:00 2001 From: maxime Date: Fri, 9 Feb 2024 20:20:00 +0100 Subject: [PATCH] fix ci --- ci/build_and_deploy_to.sh | 8 +++++--- ci/prepare_php.sh | 9 +++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 ci/prepare_php.sh diff --git a/ci/build_and_deploy_to.sh b/ci/build_and_deploy_to.sh index 61c5ecf..a5a6601 100755 --- a/ci/build_and_deploy_to.sh +++ b/ci/build_and_deploy_to.sh @@ -1,5 +1,7 @@ set -e +set -xeu + export OUTPUT=$1 export BASE=$2 @@ -10,9 +12,9 @@ echo "VITE_BASE=$BASE" >> .env.PROD ci/build_react.msh -mkdir -p $OUTPUT/profiles/ +mkdir -p "$OUTPUT"/profiles/ -sed -E 's/\/\*PROFILE_FILE\*\/\s*".*"/"profiles\/prod-config-profile.php"/' config.php > $OUTPUT/config.php +sed -E 's/\/\*PROFILE_FILE\*\/\s*".*"/"profiles\/prod-config-profile.php"/' config.php > "$OUTPUT"/config.php sed -E "s/const BASE_PATH = .*;/const BASE_PATH = \"$(sed s/\\//\\\\\\//g <<< "$BASE")\";/" profiles/prod-config-profile.php > $OUTPUT/profiles/prod-config-profile.php -cp -r vendor sql src public $OUTPUT +cp -r vendor sql src public "$OUTPUT" diff --git a/ci/prepare_php.sh b/ci/prepare_php.sh new file mode 100644 index 0000000..f2525df --- /dev/null +++ b/ci/prepare_php.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +mkdir -p /outputs/public +# this sed command will replace the included `profile/dev-config-profile.php` to `profile/prod-config-file.php` in the config.php file. +sed -E -i 's/\/\*PROFILE_FILE\*\/\s*".*"/"profiles\/prod-config-profile.php"/' config.php +DRONE_BRANCH_ESCAPED=$(sed -E 's/\//\\\//g' <<< "$DRONE_BRANCH") +sed -E -i "s/const BASE_PATH = .*;/const BASE_PATH = \"\/IQBall\/$DRONE_BRANCH_ESCAPED\/public\";/" profiles/prod-config-profile.php +rm profiles/dev-config-profile.php +mv src config.php sql profiles vendor /outputs/ \ No newline at end of file