build(gitlab-ci): 💚 iron out wrangler pages deploy commands

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>
This commit is contained in:
Andrei Jiroh Halili 2024-05-30 15:28:25 +08:00
parent 95d62c800b
commit 66bc6f5f84
No known key found for this signature in database
GPG key ID: 67BFC91B3DA12BE8

View file

@ -28,9 +28,9 @@ info() {
} }
if [[ $_branch_name_git == "main" ]] || [[ $_branch_name_git == "HEAD" ]]; then if [[ $_branch_name_git == "main" ]] || [[ $_branch_name_git == "HEAD" ]]; then
export DEPLOY_COMMAND="npx wrangler pages deploy ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch main --commit-hash ${_commit_sha} --env production" export DEPLOY_COMMAND="npx wrangler pages deploy ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch main --commit-hash ${_commit_sha}"
elif [[ $CI_PIPELINE_SOURCE == "merge_request" ]]; then elif [[ $CI_PIPELINE_SOURCE == "merge_request" ]]; then
export DEPLOY_COMMAND="npx wrangler pages deploy ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch ${_branch_name_git} --commit-hash ${_commit_sha} --env pr-$CI_MERGE_REQUEST_ID" export DEPLOY_COMMAND="npx wrangler pages deploy ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch patch-$CI_MERGE_REQUEST_ID --commit-hash ${_commit_sha}"
fi fi
if ! git diff-index --quiet HEAD -- && [[ $FF_DIRTY_DEPLOY != "true" ]]; then if ! git diff-index --quiet HEAD -- && [[ $FF_DIRTY_DEPLOY != "true" ]]; then
@ -47,17 +47,18 @@ fi
if [[ $FF_DIRTY_DEPLOY == "true" ]]; then if [[ $FF_DIRTY_DEPLOY == "true" ]]; then
$DEPLOY_COMMAND --commit-dirty=true $DEPLOY_COMMAND --commit-dirty=true
else else
DEFAULT_COMMAND="npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch main --env production" DEFAULT_COMMAND="npx wrangler pages publish ${_root_directory_git}/public --project-name ${CF_PAGES_PROJECT_NAME} --branch main"
${DEPLOY_COMMAND:-$DEFAULT_COMMAND} ${DEPLOY_COMMAND:-$DEFAULT_COMMAND}
fi fi
unset DEPLOY_COMMAND unset DEPLOY_COMMAND
if [[ $_branch_name_git == "main" ]] || [[ $_branch_name_git == "HEAD" ]]; then # temporarily disabled
tar -C public -cvz . -f site-build.tar.gz #if [[ $_branch_name_git == "main" ]] || [[ $_branch_name_git == "HEAD" ]]; then
curl --oauth2-bearer "$SOURCEHUT_PAGES_TOKEN" \ # tar -C public -cvz . -f site-build.tar.gz
-Fcontent=@site-build.tar.gz \ # curl --oauth2-bearer "$SOURCEHUT_PAGES_TOKEN" \
"https://pages.sr.ht/publish/ajhalili2006.srht.site" # -Fcontent=@site-build.tar.gz \
fi # "https://pages.sr.ht/publish/ajhalili2006.srht.site"
#fi
if [[ $DEBUG != "" ]]; then if [[ $DEBUG != "" ]]; then
set +x set +x