Skip to content

Commit b703236

Browse files
committed
Update PWA Sub Directory based on Publishing Properties
1 parent c75cdc9 commit b703236

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

application/console/views/cron/scripts/upload/default/build.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -571,21 +571,21 @@ prepare_appbuilder_project() {
571571
fi
572572
fi
573573

574-
# If modern-pwa, then use the subdirectory configuration for the rclone publish path if not defined
574+
# If modern-pwa, then update the subdirectory configuration from the rclone publish path if not defined
575575
for target in $TARGETS; do
576576
if [ "$target" = "modern-pwa" ]; then
577-
PUBLISH_TMP=$(mktemp)
577+
APPDEF_TMP=$(mktemp)
578578
INPUT_PUBLISH_PROPERTIES=$PUBLISH_PROPERTIES
579579
if [ -f "${OUTPUT_PUBLISH_PROPERTIES}" ]; then
580580
INPUT_PUBLISH_PROPERTIES=$OUTPUT_PUBLISH_PROPERTIES
581581
fi
582582
if jq -e '.PUBLISH_CLOUD_REMOTE_PATH' "${INPUT_PUBLISH_PROPERTIES}" >/dev/null; then
583-
echo "PUBLISH_CLOUD_REMOTE_PATH exists."
584-
else
585-
echo "PUBLISH_CLOUD_REMOTE_PATH set to PWA SUBDIR."
586-
PWA_SUBDIR=$(xmllint --xpath "/app-definition/pwa-manifest/pwa-sub-directory/text()" build.appDef)
587-
jq -cM ".PUBLISH_CLOUD_REMOTE_PATH += \"${PWA_SUBDIR}\"" "${INPUT_PUBLISH_PROPERTIES}" > "${PUBLISH_TMP}"
588-
cp "${PUBLISH_TMP}" "${OUTPUT_PUBLISH_PROPERTIES}"
583+
echo "PUBLISH_CLOUD_REMOTE_PATH exists. Check PWA SUBDIR."
584+
if ! xmlstarlet sel -t -v "/app-definition/pwa-manifest/pwa-sub-directory" build.appDef 2>/dev/null; then
585+
echo "set missing PWA SUBDIR to PUBLISH_CLOUD_REMOTE_PATH."
586+
xmlstarlet ed -s "/app-definition/pwa-manifest" -t elem -n "pwa-sub-directory" -v "/${PUBLISH_CLOUD_REMOTE_PATH}" build.appDef > "${APPDEF_TMP}"
587+
cp "${APPDEF_TMP}" build.appDef
588+
fi
589589
fi
590590
fi
591591
done

application/console/views/cron/scripts/upload/default/publish.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ publish_rclone() {
295295
fi
296296

297297
${RCLONE} mkdir "${PUBLISH_CLOUD_REMOTE}:${PUBLISH_CLOUD_REMOTE_ROOT}${PUBLISH_CLOUD_REMOTE_PATH}"
298+
# shellcheck disable=SC2086
298299
${RCLONE} ${PUBLISH_CLOUD_COMMAND} -u "${PUBLISH_CLOUD_SOURCE_PATH}" "${PUBLISH_CLOUD_REMOTE}:${PUBLISH_CLOUD_REMOTE_ROOT}${PUBLISH_CLOUD_REMOTE_PATH}"
299300

300301
PUBLISH_BASE_URL=$(${RCLONE} config dump | jq -r ".[\"${PUBLISH_CLOUD_REMOTE}\"].public_url")

0 commit comments

Comments
 (0)