mirror of
https://mau.dev/andreijiroh-dev/website.git
synced 2024-11-22 00:13:40 +00:00
chore(scripts): more script pain hell
Signed-off-by: Andrei Jiroh Halili <ajhalili2006@gmail.com>
This commit is contained in:
parent
4e2a5b1f0c
commit
79659f3ebd
1 changed files with 4 additions and 5 deletions
|
@ -14,7 +14,6 @@ fi
|
|||
_branch_name_git=$(git rev-parse --abbrev-ref HEAD)
|
||||
_commit_sha=$(git rev-parse HEAD)
|
||||
_commit_sha_short=$(git rev-parse --short HEAD)
|
||||
_command_prefix="npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch ${_branch_name_git} --commit-hash ${_commit_sha}"
|
||||
|
||||
warn() {
|
||||
echo "warning: $*"
|
||||
|
@ -29,9 +28,9 @@ info() {
|
|||
}
|
||||
|
||||
if [[ $_branch_name_git == "main" ]]; then
|
||||
DEPLOY_COMMAND="$_command_prefix --env production"
|
||||
DEPLOY_COMMAND="npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch ${_branch_name_git} --commit-hash ${_commit_sha} --env production"
|
||||
elif [[ $CI_PIPELINE_SOURCE == "merge_request" ]]; then
|
||||
DEPLOY_COMMAND="$_command_prefix --env pr-$CI_MERGE_REQUEST_ID"
|
||||
DEPLOY_COMMAND="npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch ${_branch_name_git} --commit-hash ${_commit_sha} --env pr-$CI_MERGE_REQUEST_ID"
|
||||
fi
|
||||
|
||||
if ! git diff-index --quiet HEAD -- && [[ $FF_DIRTY_DEPLOY != "true" ]]; then
|
||||
|
@ -46,9 +45,9 @@ if [[ ! -d "$_root_directory_git/public" ]]; then
|
|||
fi
|
||||
|
||||
if [[ $FF_DIRTY_DEPLOY == "true" ]]; then
|
||||
bash $DEPLOY_COMMAND --commit-dirty
|
||||
$DEPLOY_COMMAND --commit-dirty
|
||||
else
|
||||
bash ${DEPLOY_COMMAND:-"$_command_prefix"}
|
||||
${DEPLOY_COMMAND}
|
||||
fi
|
||||
|
||||
if [[ $_branch_name_git == "main" ]]; then
|
||||
|
|
Loading…
Reference in a new issue