Skip to content

Commit b1d7c08

Browse files
committed
add back fingerprint comparison
1 parent 24f9c54 commit b1d7c08

File tree

1 file changed

+120
-121
lines changed

1 file changed

+120
-121
lines changed

.github/workflows/push-eas-update.yml

Lines changed: 120 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -30,110 +30,110 @@ env:
3030
TARGET_PR_NUMBER: '22840'
3131

3232
jobs:
33-
# fingerprint-comparison:
34-
# name: Compare Expo Fingerprints
35-
# runs-on: ubuntu-latest
36-
# env:
37-
# BASE_BRANCH_REF: 'wsun/eas-updates-key-signing'
38-
# outputs:
39-
# branch_fingerprint: ${{ steps.branch_fingerprint.outputs.fingerprint }}
40-
# main_fingerprint: ${{ steps.main_fingerprint.outputs.fingerprint }}
41-
# fingerprints_equal: ${{ steps.compare.outputs.equal }}
42-
# steps:
43-
# - name: Checkout target PR branch
44-
# uses: actions/checkout@v4
45-
# with:
46-
# ref: refs/pull/${{ env.TARGET_PR_NUMBER }}/head
47-
# fetch-depth: 0
48-
#
49-
# - name: Checkout base branch snapshot
50-
# uses: actions/checkout@v4
51-
# with:
52-
# ref: ${{ env.BASE_BRANCH_REF }}
53-
# path: main
54-
# fetch-depth: 0
55-
#
56-
# - name: Setup Node.js
57-
# uses: actions/setup-node@v4
58-
# with:
59-
# node-version: '20'
60-
# cache: 'yarn'
61-
#
62-
# - name: Install dependencies (workflow branch)
63-
# run: |
64-
# echo "📦 Installing dependencies for current branch..."
65-
# yarn install --immutable
66-
#
67-
# - name: Generate fingerprint (workflow branch)
68-
# id: branch_fingerprint
69-
# run: |
70-
# echo "🧬 Generating fingerprint for current branch..."
71-
# FINGERPRINT=$(yarn fingerprint:generate)
72-
# echo "fingerprint=$FINGERPRINT" >> "$GITHUB_OUTPUT"
73-
# echo "Target PR fingerprint: $FINGERPRINT"
74-
# echo "Writing detailed fingerprint file to fingerprint-pr.json"
75-
# npx @expo/fingerprint ./ > fingerprint-pr.json
76-
#
77-
# - name: Install dependencies (base branch)
78-
# working-directory: main
79-
# run: |
80-
# echo "📦 Installing dependencies for base branch snapshot (${BASE_BRANCH_REF})..."
81-
# yarn install --immutable
82-
#
83-
# - name: Generate fingerprint (base branch)
84-
# id: main_fingerprint
85-
# working-directory: main
86-
# run: |
87-
# echo "🧬 Generating fingerprint for base branch (${BASE_BRANCH_REF})..."
88-
# FINGERPRINT=$(yarn fingerprint:generate)
89-
# echo "fingerprint=$FINGERPRINT" >> "$GITHUB_OUTPUT"
90-
# echo "Base branch fingerprint: $FINGERPRINT"
91-
# echo "Writing detailed fingerprint file to ../fingerprint-base.json"
92-
# npx @expo/fingerprint ./ > ../fingerprint-base.json
93-
#
94-
# - name: Compare fingerprints
95-
# id: compare
96-
# env:
97-
# BRANCH_FP: ${{ steps.branch_fingerprint.outputs.fingerprint }}
98-
# MAIN_FP: ${{ steps.main_fingerprint.outputs.fingerprint }}
99-
# run: |
100-
# if [ -z "$BRANCH_FP" ] || [ -z "$MAIN_FP" ]; then
101-
# echo "❌ Fingerprint generation failed." >&2
102-
# exit 1
103-
# fi
104-
#
105-
# echo "Target PR fingerprint: $BRANCH_FP"
106-
# echo "Base branch fingerprint: $MAIN_FP"
107-
#
108-
# if [ "$BRANCH_FP" = "$MAIN_FP" ]; then
109-
# echo "✅ Fingerprints match. No native changes detected."
110-
# echo "equal=true" >> "$GITHUB_OUTPUT"
111-
# else
112-
# echo "⚠️ Fingerprints differ. Native changes detected."
113-
# echo "equal=false" >> "$GITHUB_OUTPUT"
114-
# if [ -f fingerprint-base.json ] && [ -f fingerprint-pr.json ]; then
115-
# echo "Fingerprint differences:"
116-
# npx @expo/fingerprint ./ fingerprint-base.json fingerprint-pr.json || true
117-
# else
118-
# echo "Detailed fingerprint files not found; skipping diff."
119-
# fi
120-
# fi
121-
#
122-
# - name: Record fingerprint summary
123-
# env:
124-
# BRANCH_FP: ${{ steps.branch_fingerprint.outputs.fingerprint }}
125-
# MAIN_FP: ${{ steps.main_fingerprint.outputs.fingerprint }}
126-
# MATCHES: ${{ steps.compare.outputs.equal }}
127-
# TARGET_PR_NUMBER: ${{ env.TARGET_PR_NUMBER }}
128-
# BASE_BRANCH_REF: ${{ env.BASE_BRANCH_REF }}
129-
# run: |
130-
# {
131-
# echo "### Expo Fingerprint Comparison"
132-
# echo ""
133-
# echo "- Target PR (#$TARGET_PR_NUMBER) fingerprint: \`$BRANCH_FP\`"
134-
# echo "- Base branch (\`$BASE_BRANCH_REF\`) fingerprint: \`$MAIN_FP\`"
135-
# echo "- Match: \`$MATCHES\`"
136-
# } >> "$GITHUB_STEP_SUMMARY"
33+
fingerprint-comparison:
34+
name: Compare Expo Fingerprints
35+
runs-on: ubuntu-latest
36+
env:
37+
BASE_BRANCH_REF: 'wsun/eas-updates-key-signing'
38+
outputs:
39+
branch_fingerprint: ${{ steps.branch_fingerprint.outputs.fingerprint }}
40+
main_fingerprint: ${{ steps.main_fingerprint.outputs.fingerprint }}
41+
fingerprints_equal: ${{ steps.compare.outputs.equal }}
42+
steps:
43+
- name: Checkout target PR branch
44+
uses: actions/checkout@v4
45+
with:
46+
ref: refs/pull/${{ env.TARGET_PR_NUMBER }}/head
47+
fetch-depth: 0
48+
49+
- name: Checkout base branch snapshot
50+
uses: actions/checkout@v4
51+
with:
52+
ref: ${{ env.BASE_BRANCH_REF }}
53+
path: main
54+
fetch-depth: 0
55+
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '20'
60+
cache: 'yarn'
61+
62+
- name: Install dependencies (workflow branch)
63+
run: |
64+
echo "📦 Installing dependencies for current branch..."
65+
yarn install --immutable
66+
67+
- name: Generate fingerprint (workflow branch)
68+
id: branch_fingerprint
69+
run: |
70+
echo "🧬 Generating fingerprint for current branch..."
71+
FINGERPRINT=$(yarn fingerprint:generate)
72+
echo "fingerprint=$FINGERPRINT" >> "$GITHUB_OUTPUT"
73+
echo "Target PR fingerprint: $FINGERPRINT"
74+
echo "Writing detailed fingerprint file to fingerprint-pr.json"
75+
npx @expo/fingerprint ./ > fingerprint-pr.json
76+
77+
- name: Install dependencies (base branch)
78+
working-directory: main
79+
run: |
80+
echo "📦 Installing dependencies for base branch snapshot (${BASE_BRANCH_REF})..."
81+
yarn install --immutable
82+
83+
- name: Generate fingerprint (base branch)
84+
id: main_fingerprint
85+
working-directory: main
86+
run: |
87+
echo "🧬 Generating fingerprint for base branch (${BASE_BRANCH_REF})..."
88+
FINGERPRINT=$(yarn fingerprint:generate)
89+
echo "fingerprint=$FINGERPRINT" >> "$GITHUB_OUTPUT"
90+
echo "Base branch fingerprint: $FINGERPRINT"
91+
echo "Writing detailed fingerprint file to ../fingerprint-base.json"
92+
npx @expo/fingerprint ./ > ../fingerprint-base.json
93+
94+
- name: Compare fingerprints
95+
id: compare
96+
env:
97+
BRANCH_FP: ${{ steps.branch_fingerprint.outputs.fingerprint }}
98+
MAIN_FP: ${{ steps.main_fingerprint.outputs.fingerprint }}
99+
run: |
100+
if [ -z "$BRANCH_FP" ] || [ -z "$MAIN_FP" ]; then
101+
echo "❌ Fingerprint generation failed." >&2
102+
exit 1
103+
fi
104+
105+
echo "Target PR fingerprint: $BRANCH_FP"
106+
echo "Base branch fingerprint: $MAIN_FP"
107+
108+
if [ "$BRANCH_FP" = "$MAIN_FP" ]; then
109+
echo "✅ Fingerprints match. No native changes detected."
110+
echo "equal=true" >> "$GITHUB_OUTPUT"
111+
else
112+
echo "⚠️ Fingerprints differ. Native changes detected."
113+
echo "equal=false" >> "$GITHUB_OUTPUT"
114+
if [ -f fingerprint-base.json ] && [ -f fingerprint-pr.json ]; then
115+
echo "Fingerprint differences:"
116+
npx @expo/fingerprint ./ fingerprint-base.json fingerprint-pr.json || true
117+
else
118+
echo "Detailed fingerprint files not found; skipping diff."
119+
fi
120+
fi
121+
122+
- name: Record fingerprint summary
123+
env:
124+
BRANCH_FP: ${{ steps.branch_fingerprint.outputs.fingerprint }}
125+
MAIN_FP: ${{ steps.main_fingerprint.outputs.fingerprint }}
126+
MATCHES: ${{ steps.compare.outputs.equal }}
127+
TARGET_PR_NUMBER: ${{ env.TARGET_PR_NUMBER }}
128+
BASE_BRANCH_REF: ${{ env.BASE_BRANCH_REF }}
129+
run: |
130+
{
131+
echo "### Expo Fingerprint Comparison"
132+
echo ""
133+
echo "- Target PR (#$TARGET_PR_NUMBER) fingerprint: \`$BRANCH_FP\`"
134+
echo "- Base branch (\`$BASE_BRANCH_REF\`) fingerprint: \`$MAIN_FP\`"
135+
echo "- Match: \`$MATCHES\`"
136+
} >> "$GITHUB_STEP_SUMMARY"
137137
138138
# approval:
139139
# name: Require OTA Update Approval
@@ -152,12 +152,11 @@ jobs:
152152
name: Push EAS Update
153153
runs-on: ubuntu-latest
154154
environment: expo-update
155-
# needs:
156-
# - fingerprint-comparison
157-
# # - approval
158-
# if: ${{ needs.fingerprint-comparison.outputs.fingerprints_equal == 'true' }}
155+
needs:
156+
- fingerprint-comparison
157+
# - approval
158+
if: ${{ needs.fingerprint-comparison.outputs.fingerprints_equal == 'true' }}
159159
env:
160-
TARGET_PR_NUMBER: '22840'
161160
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
162161
EXPO_PROJECT_ID: ${{ secrets.EXPO_PROJECT_ID }}
163162
EXPO_CHANNEL: ${{ vars.EXPO_CHANNEL }}
@@ -267,15 +266,15 @@ jobs:
267266
echo "" >> $GITHUB_STEP_SUMMARY
268267
echo "Check the logs above for error details." >> $GITHUB_STEP_SUMMARY
269268
270-
# fingerprint-mismatch:
271-
# name: Fingerprint Mismatch Guard
272-
# needs: fingerprint-comparison
273-
# if: ${{ needs.fingerprint-comparison.outputs.fingerprints_equal != 'true' }}
274-
# runs-on: ubuntu-latest
275-
# steps:
276-
# - name: Fail on native changes
277-
# run: |
278-
# echo "::error title=Fingerprint mismatch::Current branch fingerprint differs from main. Native changes detected; aborting workflow."
279-
# echo "Current fingerprint: ${{ needs.fingerprint-comparison.outputs.branch_fingerprint }}"
280-
# echo "Main fingerprint: ${{ needs.fingerprint-comparison.outputs.main_fingerprint }}"
281-
# exit 1
269+
fingerprint-mismatch:
270+
name: Fingerprint Mismatch Guard
271+
needs: fingerprint-comparison
272+
if: ${{ needs.fingerprint-comparison.outputs.fingerprints_equal != 'true' }}
273+
runs-on: ubuntu-latest
274+
steps:
275+
- name: Fail on native changes
276+
run: |
277+
echo "::error title=Fingerprint mismatch::Current branch fingerprint differs from main. Native changes detected; aborting workflow."
278+
echo "Current fingerprint: ${{ needs.fingerprint-comparison.outputs.branch_fingerprint }}"
279+
echo "Main fingerprint: ${{ needs.fingerprint-comparison.outputs.main_fingerprint }}"
280+
exit 1

0 commit comments

Comments
 (0)