Skip to content

Commit 737bc06

Browse files
committed
Add data management json generation
1 parent 7c77f4b commit 737bc06

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

scripts/upload/default/build.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,28 @@ download_play_listing() {
458458
fi
459459
}
460460

461+
extract_about() {
462+
ABOUT_ENABLED=$(xmlstarlet sel -t -v "/app-definition/about/@enabled" "${PROJECT_DIR}/build.appDef" || echo "true")
463+
if [[ "${ABOUT_ENABLED}" == "true" ]]; then
464+
ABOUT_FILENAME=$(xmlstarlet sel -t -v "/app-definition/about/filename" "${PROJECT_DIR}/build.appDef" || echo "about.txt")
465+
if [ -f "${PROJECT_DIR}/build_data/about/${ABOUT_FILENAME}" ]; then
466+
cp "${PROJECT_DIR}/build_data/about/${ABOUT_FILENAME}" "${OUTPUT_DIR}/about.txt"
467+
fi
468+
fi
469+
}
470+
471+
extract_data_management_url() {
472+
if [ -f "build_data/firebase/google-services.json" ]; then
473+
USER_ACCOUNTS_ENABLED=$(xmlstarlet sel -t -v "/app-definition/features/feature[@name = 'user-accounts']/@value" "${PROJECT_DIR}/build.appDef" || echo "false")
474+
if [[ "${USER_ACCOUNTS_ENABLED}" == "true" ]]; then
475+
CONSOLE_URL=$(jq -r '.project_info.firebase_url' "${PROJECT_DIR}/build_data/firebase/google-services.json")
476+
if [[ "${CONSOLE_URL}" != "" ]]; then
477+
jq -n --arg console_url "$CONSOLE_URL" '{console_url: $console_url}' > "${OUTPUT_DIR}/data_management.json"
478+
fi
479+
fi
480+
fi
481+
}
482+
461483
build_play_listing() {
462484
echo "Build play listing"
463485
echo "BUILD_NUMBER=${BUILD_NUMBER}"
@@ -471,9 +493,9 @@ build_play_listing() {
471493
APK_FILES=("${OUTPUT_DIR}"/*.apk)
472494
AAPT="$(find /opt/android-sdk/build-tools -name aapt | head -n 1)"
473495

474-
if [ -f "build_data/about/about.txt" ]; then
475-
cp build_data/about/about.txt "$OUTPUT_DIR"/
476-
fi
496+
extract_about
497+
extract_data_management_url
498+
477499
PUBLISH_DIR="build_data/publish"
478500
PLAY_LISTING_DIR="${PUBLISH_DIR}/play-listing"
479501
LIST_DIR="${PLAY_LISTING_DIR}/"

src/lib/server/models/build.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export namespace Build {
4747
AssetPreview = 'asset-preview',
4848
AssetNotify = 'asset-notify',
4949
DataSafetyCsv = 'data-safety-csv',
50-
PlayListingDownload = 'play-listing-download'
50+
PlayListingDownload = 'play-listing-download',
51+
DataManagement = 'data-management'
5152
}
5253

5354
export function artifactType(key: string): [Artifact, string] {
@@ -72,6 +73,8 @@ export namespace Build {
7273
type = Artifact.PublishProperties;
7374
} else if (file === 'about.txt') {
7475
type = Artifact.About;
76+
} else if (file === 'data_management.json') {
77+
type = Artifact.DataManagement;
7578
} else if (file === 'whats_new.txt') {
7679
type = Artifact.WhatsNew;
7780
} else if (file === 'html.zip') {
@@ -155,9 +158,10 @@ export namespace Build {
155158
);
156159
artifacts[Artifact.WhatsNew] = getArtifactUrl(/whats_new\.txt/, base, files);
157160
artifacts[Artifact.PlayListingDownload] = getArtifactUrl(/play-listing\.zip$/, base, files);
161+
artifacts[Artifact.DataManagement] = getArtifactUrl(/data_management\.json/, base, files);
158162
}
159163

160-
if (targets?.match('play-html')) {
164+
if (targets?.match('html')) {
161165
artifacts[Artifact.HTML] = getArtifactUrl(/html\.zip/, base, files);
162166
}
163167

0 commit comments

Comments
 (0)