@@ -25,16 +25,17 @@ jobs:
25
25
ref : ${{ github.event.before }}
26
26
token : ${{ secrets.OS_BOTIFY_TOKEN }}
27
27
28
- - name : Get previous App commit hash
29
- id : getOldAppHash
30
- run : echo "HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
31
-
32
- - name : Get previous Mobile-Expensify commit hash
33
- if : ${{ matrix.is_hybrid }}
34
- id : getOldMobileExpensifyHash
35
- run : echo "HASH=$(git rev-parse :Mobile-Expensify)" >> "$GITHUB_OUTPUT"
28
+ - name : Get previous patches hash
29
+ id : getOldPatchesHash
30
+ run : |
31
+ if [[ "${{ matrix.is_hybrid }}" == "true" ]]; then
32
+ echo "HASH=$(./scripts/compute-patches-hash.sh patches Mobile-Expensify/patches)" >> "$GITHUB_OUTPUT"
33
+ else
34
+ echo "HASH=$(./scripts/compute-patches-hash.sh patches)" >> "$GITHUB_OUTPUT"
35
+ fi
36
36
37
37
- name : Get previous react-native version
38
+
38
39
id : getOldVersion
39
40
run : echo "VERSION=$(jq -r '.dependencies["react-native"]' package.json)" >> "$GITHUB_OUTPUT"
40
41
@@ -44,14 +45,14 @@ jobs:
44
45
git checkout ${{ github.event.after }}
45
46
git submodule update
46
47
47
- - name : Get new App commit hash
48
- id : getNewAppHash
49
- run : echo "HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
50
-
51
- - name : Get new Mobile-Expensify commit hash
52
- if : ${{ matrix.is_hybrid }}
53
- id : getNewMobileExpensifyHash
54
- run : echo "HASH=$(git rev-parse :Mobile-Expensify)" >> "$GITHUB_OUTPUT"
48
+ - name : Get new patches hash
49
+ id : getNewPatchesHash
50
+ run : |
51
+ if [[ "${{ matrix.is_hybrid }}" == "true" ]]; then
52
+ echo "HASH=$(./scripts/compute-patches-hash.sh patches Mobile-Expensify/patches)" >> "$GITHUB_OUTPUT"
53
+ else
54
+ echo "HASH=$(./scripts/compute-patches-hash.sh patches)" >> "$GITHUB_OUTPUT"
55
+ fi
55
56
56
57
- name : Get new react-native version
57
58
id : getNewVersion
@@ -69,22 +70,12 @@ jobs:
69
70
- name : Check if patches changed
70
71
id : didPatchesChange
71
72
run : |
72
- if ! git diff --exit-code --name-only ${{ steps.getOldAppHash .outputs.HASH }}..${{ steps.getNewAppHash .outputs.HASH }} -- patches/react-native+*.patch patches/@react-native+*.patch; then
73
- echo "::notice::Detected changes in patches (Standalone NewDot) "
74
- echo " DID_PATCHES_CHANGE= true" >> "$GITHUB_OUTPUT"
75
- exit 0
73
+ readonly DID_PATCHES_CHANGE= ${{ steps.getOldPatchesHash .outputs.HASH != steps.getNewPatchesHash .outputs.HASH && 'true' || 'false' }}
74
+ echo "DID_PATCHES_CHANGE=$DID_PATCHES_CHANGE" >> "$GITHUB_OUTPUT "
75
+ if [[ "$ DID_PATCHES_CHANGE" == ' true' ]]; then
76
+ echo "::notice::Detected changes in patches (${{ steps.getOldPatchesHash.outputs.HASH }} -> ${{ steps.getNewPatchesHash.outputs.HASH }})"
76
77
fi
77
78
78
- if [[ '${{ matrix.is_hybrid }}' == 'true' ]]; then
79
- if ! git -C Mobile-Expensify diff --exit-code --name-only ${{ steps.getOldMobileExpensifyHash.outputs.HASH }}..${{ steps.getNewMobileExpensifyHash.outputs.HASH }} -- patches/react-native+*.patch patches/@react-native+*.patch; then
80
- echo "::notice::Detected changes in patches (HybridApp)"
81
- echo "DID_PATCHES_CHANGE=true" >> "$GITHUB_OUTPUT"
82
- exit 0
83
- fi
84
- fi
85
-
86
- echo "DID_PATCHES_CHANGE=false" >> "$GITHUB_OUTPUT"
87
-
88
79
- name : Check if we should build and publish the package
89
80
id : shouldPublish
90
81
run : |
@@ -128,7 +119,7 @@ jobs:
128
119
run : |
129
120
echo "Starting artifacts build for ${{ matrix.is_hybrid && 'HybridApp' || 'NewDot Standalone' }}"
130
121
echo "Version: ${{ env.PATCHED_VERSION }}"
131
- echo "Commit hash: ${{ env.COMMIT_HASH }}"
122
+ echo "Patches hash: ${{ env.PATCHES_HASH }}"
132
123
export ORG_GRADLE_PROJECT_reactNativeArchitectures="armeabi-v7a,arm64-v8a,x86,x86_64"
133
124
./gradlew buildReactNativeArtifacts -x lint -x test -x check
134
125
./gradlew publishReactNativeArtifacts
@@ -137,7 +128,7 @@ jobs:
137
128
GH_PUBLISH_TOKEN : ${{ github.token }}
138
129
IS_HYBRID_BUILD : ${{ matrix.is_hybrid }}
139
130
PATCHED_VERSION : ${{ steps.getNewPatchedVersion.outputs.NEW_PATCHED_VERSION }}
140
- COMMIT_HASH : ${{ github.event.after }}
131
+ PATCHES_HASH : ${{ steps.getNewPatchesHash.outputs.HASH }}
141
132
142
133
- name : Announce failed workflow in Slack
143
134
if : ${{ failure() }}
0 commit comments