From f9e301b3f0dcbb8443cb82d8dbd5fedf9bbe680a Mon Sep 17 00:00:00 2001 From: Rui <102453770+ruixhuang@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:58:26 -0700 Subject: [PATCH] Add script to inject iOS app ID to public/.well-known/apple-app-site-association (#66) * Add script to inject iOS app ID to public/.well-known/apple-app-site-association * package.json * Fix typo * Fix typo * Fix build * Debug * Updated to use "dist" folder --- .github/workflows/deploy-testnet.yml | 2 ++ package.json | 1 + scripts/inject-app-deeplinks.sh | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100755 scripts/inject-app-deeplinks.sh diff --git a/.github/workflows/deploy-testnet.yml b/.github/workflows/deploy-testnet.yml index 8aef558..f2edc93 100644 --- a/.github/workflows/deploy-testnet.yml +++ b/.github/workflows/deploy-testnet.yml @@ -33,11 +33,13 @@ jobs: AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }} BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }} STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }} + IOS_APP_ID: ${{ secrets.IOS_APP_ID }} run: | pnpm run build pnpm run build:inject-amplitude pnpm run build:inject-bugsnag pnpm run build:inject-statuspage + sh scripts/inject-app-deeplinks.sh - name: Upload to IPFS via web3.storage uses: dydxprotocol/add-to-web3@v1 diff --git a/package.json b/package.json index a7f8f3d..fa14148 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "build:inject-app-deeplinks": "sh scripts/inject-app-deeplinks.sh", "build:inject-amplitude": "node scripts/inject-amplitude.js", "build:inject-bugsnag": "node scripts/inject-bugsnag.js", "build:inject-statuspage": "node scripts/inject-statuspage.js", diff --git a/scripts/inject-app-deeplinks.sh b/scripts/inject-app-deeplinks.sh new file mode 100755 index 0000000..1877fbf --- /dev/null +++ b/scripts/inject-app-deeplinks.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +source="dist/.well-known/apple-app-site-association" +if [ ! -f "$source" ]; then + echo "Error: $source file not found" + exit 1 +fi + +app_id=$IOS_APP_ID +if [ -z "$app_id" ]; then + echo "Error: IOS_APP_ID is empty" + exit 1 +fi + +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source +else + sed -i "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source +fi \ No newline at end of file