From 9ad402842d80a127f6a6692ee594e47487f9df73 Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Fri, 26 Aug 2022 12:02:29 +0200 Subject: [PATCH] feat: automate generation for universal link files --- .gitignore | 3 +- Makefile | 2 + static/scripts/universal_link_files.sh | 58 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 static/scripts/universal_link_files.sh diff --git a/.gitignore b/.gitignore index f5227102..fe63bea5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ app Gemfile.lock -.vscode \ No newline at end of file +.vscode +.DS_Store \ No newline at end of file diff --git a/Makefile b/Makefile index 7c5aa2c4..95dc195f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ SHELL := /bin/bash APP_DIR := $(PWD)/app BRANCH ?= develop +START_TIME := $(date +%s) clean: rm -rf app @@ -27,6 +28,7 @@ web-build: configuration-web cd app && ionic build --prod web: web-build + mkdir -p app/www/.well-known && source app.conf && sh static/scripts/universal_link_files.sh cd app/www && zip -r ../../www.zip . echo "Web application artifact for version ${VERSION} is archived in www.zip" diff --git a/static/scripts/universal_link_files.sh b/static/scripts/universal_link_files.sh new file mode 100644 index 00000000..3595ad4e --- /dev/null +++ b/static/scripts/universal_link_files.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env sh + +. $PWD/app.conf + +# iOS universal link file generation +if [ -z "$TEAM_ID" ] && [ -z "$IOS_BUNDLE_IDENTIFIER" ] +then + echo "Unable to find Apple Team ID and bundle identifier. Skipping apple-app-site-association generation..." +else + file_content=$(cat < $PWD/app/www/.well-known/apple-app-site-association +fi + + +# Google Play/Android universal link file generation +KEYTOOL_INFO=$(keytool -list -v -keystore ./playstore.keystore -alias $ANDROID_KEYSTORE_KEY_ALIAS -storepass $ANDROID_KEYSTORE_PASSWORD -keypass $ANDROID_KEYSTORE_KEY_PASSWORD || true) +CERT_FINGERPRINT=$(echo $KEYTOOL_INFO | sed -n 's/.*SHA256: //p') + +if [ -z "$CERT_FINGERPRINT" ] +then + echo "Unable to retrieve Android sigining SHA256 fingerprint. Skipping assetlinks.json generation..." +else + file_content=$(cat < $PWD/app/www/.well-known/assetlinks.json +fi