@@ -4,6 +4,7 @@ run-name: "Mobile POS OTA - production"
44permissions :
55 id-token : write
66 contents : read
7+ actions : read
78
89on :
910 workflow_dispatch :
@@ -35,48 +36,88 @@ jobs:
3536 fi
3637 echo "${{ secrets.POS_ENV_FILE }}" > dapps/pos-app/.env
3738
38- - name : Setup EAS CLI
39- run : npm install -g eas-cli
39+ - name : Compute current fingerprints
40+ id : fingerprints
41+ run : |
42+ cd dapps/pos-app
43+ ANDROID_FINGERPRINT=$(npx expo-updates fingerprint:generate --platform android 2>/dev/null | tail -1 | jq -r '.hash')
44+ IOS_FINGERPRINT=$(npx expo-updates fingerprint:generate --platform ios 2>/dev/null | tail -1 | jq -r '.hash')
45+ echo "android=$ANDROID_FINGERPRINT" >> "$GITHUB_OUTPUT"
46+ echo "ios=$IOS_FINGERPRINT" >> "$GITHUB_OUTPUT"
47+ echo "Current Android fingerprint: $ANDROID_FINGERPRINT"
48+ echo "Current iOS fingerprint: $IOS_FINGERPRINT"
49+
50+ - name : Download last native build fingerprint (Android)
51+ id : download-fingerprint-android
52+ uses : dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
53+ with :
54+ name : native-fingerprint-android-production
55+ workflow : release-pos.yaml
56+ if_no_artifact_found : warn
57+ path : /tmp/native-fingerprint/android
58+
59+ - name : Download last native build fingerprint (iOS)
60+ id : download-fingerprint-ios
61+ uses : dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
62+ with :
63+ name : native-fingerprint-ios-production
64+ workflow : release-pos.yaml
65+ if_no_artifact_found : warn
66+ path : /tmp/native-fingerprint/ios
4067
4168 - name : Check for native changes
4269 id : native-check
43- working-directory : dapps/pos-app
4470 env :
45- EXPO_TOKEN : ${{ secrets.EXPO_TOKEN }}
71+ CURRENT_ANDROID_FINGERPRINT : ${{ steps.fingerprints.outputs.android }}
72+ CURRENT_IOS_FINGERPRINT : ${{ steps.fingerprints.outputs.ios }}
4673 run : |
4774 HAS_NATIVE_CHANGES=false
4875
49- for PLATFORM in android ios; do
50- echo "--- Checking $PLATFORM ---"
51- BUILD_LIST_OUTPUT=$(eas build:list --platform "$PLATFORM" --channel production --limit 1 --json --non-interactive 2>&1) || true
52- BUILD_ID=$(echo "$BUILD_LIST_OUTPUT" | jq -r '.[0].id' 2>/dev/null)
76+ ANDROID_FINGERPRINT_PATH=/tmp/native-fingerprint/android/native-fingerprint.txt
77+ IOS_FINGERPRINT_PATH=/tmp/native-fingerprint/ios/native-fingerprint.txt
5378
54- if [ -z "$BUILD_ID" ] || [ "$BUILD_ID" = "null" ]; then
55- echo "No previous $PLATFORM build found for channel 'production'. Skipping check."
56- continue
79+ if [ -f "$ANDROID_FINGERPRINT_PATH" ]; then
80+ LAST_ANDROID_FINGERPRINT=$(cat "$ANDROID_FINGERPRINT_PATH")
81+ echo "Last native Android fingerprint: $LAST_ANDROID_FINGERPRINT"
82+ echo "Current Android fingerprint: $CURRENT_ANDROID_FINGERPRINT"
83+
84+ if [ "$LAST_ANDROID_FINGERPRINT" != "$CURRENT_ANDROID_FINGERPRINT" ]; then
85+ HAS_NATIVE_CHANGES=true
86+ echo "::error::Android native changes detected. Current fingerprint does not match the last native Android build."
5787 fi
88+ else
89+ echo "No previous native Android fingerprint found for channel 'production'."
90+ fi
5891
59- echo "Latest $PLATFORM build: $BUILD_ID"
60- DIFF=$(eas fingerprint:compare --build-id "$BUILD_ID" --platform "$PLATFORM" --json --non-interactive 2>&1) || true
61- IS_MATCH=$(echo "$DIFF" | jq -r '.isCompatible // .isMatch // empty' 2>/dev/null)
92+ if [ -f "$IOS_FINGERPRINT_PATH" ]; then
93+ LAST_IOS_FINGERPRINT=$(cat "$IOS_FINGERPRINT_PATH")
94+ echo "Last native iOS fingerprint: $LAST_IOS_FINGERPRINT"
95+ echo "Current iOS fingerprint: $CURRENT_IOS_FINGERPRINT"
6296
63- if [ "$IS_MATCH" = "true" ]; then
64- echo "$PLATFORM fingerprint matches the latest native build."
65- else
97+ if [ "$LAST_IOS_FINGERPRINT" != "$CURRENT_IOS_FINGERPRINT" ]; then
6698 HAS_NATIVE_CHANGES=true
67- echo "::error::$PLATFORM native changes detected. Current fingerprint does not match build $BUILD_ID."
68- echo "$DIFF" | jq . 2>/dev/null || echo "$DIFF"
99+ echo "::error::iOS native changes detected. Current fingerprint does not match the last native iOS build."
69100 fi
70- done
101+ else
102+ echo "No previous native iOS fingerprint found for channel 'production'."
103+ fi
71104
72105 if [ "$HAS_NATIVE_CHANGES" = "true" ]; then
73106 echo "has_native_changes=true" >> "$GITHUB_OUTPUT"
74107 echo "::error::Native changes detected. You must create a new native release before publishing an OTA update."
75108 exit 1
76109 fi
77110
111+ if [ ! -f "$ANDROID_FINGERPRINT_PATH" ] || [ ! -f "$IOS_FINGERPRINT_PATH" ]; then
112+ echo "At least one platform fingerprint is missing. This can happen after initial OTA setup."
113+ echo "Proceeding with OTA publish."
114+ fi
115+
78116 echo "has_native_changes=false" >> "$GITHUB_OUTPUT"
79- echo "Fingerprints match — safe to publish OTA update."
117+ echo "Fingerprints match for all available platform artifacts — safe to publish OTA update."
118+
119+ - name : Setup EAS CLI
120+ run : npm install -g eas-cli
80121
81122 - name : Publish OTA update
82123 id : eas-update
0 commit comments