Skip to content

Commit f5d3587

Browse files
revert(ci): restore artifact-based fingerprint comparison
EAS fingerprint API only works with EAS Build, but we build natively with Gradle/Fastlane. Revert to artifact-based approach with the original fixes: jq hash extraction and env block for safe shell interpolation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c07ae1a commit f5d3587

File tree

3 files changed

+96
-21
lines changed

3 files changed

+96
-21
lines changed

.github/workflows/ota-update-pos.yaml

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ run-name: "Mobile POS OTA - production"
44
permissions:
55
id-token: write
66
contents: read
7+
actions: read
78

89
on:
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

.github/workflows/release-android-base.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ jobs:
9393
env:
9494
EAS_UPDATE_CHANNEL: ${{ inputs.eas-update-channel }}
9595

96+
- name: Compute and upload native fingerprint
97+
if: ${{ inputs.eas-update-channel != '' }}
98+
run: |
99+
cd ${{ inputs.root-path }}
100+
FINGERPRINT=$(npx expo-updates fingerprint:generate --platform android 2>/dev/null | tail -1 | jq -r '.hash')
101+
echo "$FINGERPRINT" > native-fingerprint.txt
102+
echo "Native fingerprint: $FINGERPRINT"
103+
104+
- name: Upload native fingerprint artifact
105+
if: ${{ inputs.eas-update-channel != '' }}
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: native-fingerprint-android-${{ inputs.eas-update-channel }}
109+
path: ${{ inputs.root-path }}/native-fingerprint.txt
110+
retention-days: 90
111+
overwrite: true
112+
96113
- name: Install Java 17
97114
uses: actions/setup-java@v3
98115
with:

.github/workflows/release-ios-base.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,23 @@ jobs:
129129
env:
130130
EAS_UPDATE_CHANNEL: ${{ inputs.eas-update-channel }}
131131

132+
- name: Compute and upload native fingerprint
133+
if: ${{ inputs.eas-update-channel != '' }}
134+
run: |
135+
cd ${{ inputs.root-path }}
136+
FINGERPRINT=$(npx expo-updates fingerprint:generate --platform ios 2>/dev/null | tail -1 | jq -r '.hash')
137+
echo "$FINGERPRINT" > native-fingerprint.txt
138+
echo "Native fingerprint: $FINGERPRINT"
139+
140+
- name: Upload native fingerprint artifact
141+
if: ${{ inputs.eas-update-channel != '' }}
142+
uses: actions/upload-artifact@v4
143+
with:
144+
name: native-fingerprint-ios-${{ inputs.eas-update-channel }}
145+
path: ${{ inputs.root-path }}/native-fingerprint.txt
146+
retention-days: 90
147+
overwrite: true
148+
132149
- name: Set Xcode paths
133150
run: |
134151
# Find the .xcodeproj and .xcworkspace (works for both Expo and non-Expo)

0 commit comments

Comments
 (0)