feat: automate generation for universal link files

This commit is contained in:
Rainer Killinger
2022-08-26 12:02:29 +02:00
parent e9bedb78c6
commit 9ad402842d
3 changed files with 62 additions and 1 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
app
Gemfile.lock
.vscode
.vscode
.DS_Store

View File

@@ -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"

View File

@@ -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 <<EOF
{
"applinks": {
"details": [
{
"appIDs": [ "${TEAM_ID}.${IOS_BUNDLE_IDENTIFIER}"],
"components": [
{
"/": "/*",
"comment": "Match all links"
}
]
}
]
}
}
EOF
)
echo $file_content > $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 <<EOF
[
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "${ANDROID_PACKAGE_NAME}",
"sha256_cert_fingerprints": [
"${CERT_FINGERPRINT}"
]
}
}
]
EOF
)
echo $file_content > $PWD/app/www/.well-known/assetlinks.json
fi