24
24
token : ${{ secrets.OS_BOTIFY_TOKEN }}
25
25
submodules : true
26
26
27
+ # This command is necessary to fetch any branch other than main in the submodule.
28
+ # See https://github.com/actions/checkout/issues/1815#issuecomment-2777836442 for further context.
29
+ - name : Enable branch-switching in submodules
30
+ run : git submodule foreach 'git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"'
31
+
27
32
- name : Set up git for OSBotify
28
33
id : setupGitForOSBotify
29
34
uses : Expensify/GitHub-Actions/setupGitForOSBotify@main
@@ -40,30 +45,59 @@ jobs:
40
45
SEMVER_LEVEL : " PATCH"
41
46
42
47
- name : Fetch history of relevant refs
43
- run : git fetch origin main staging --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}
48
+ run : |
49
+ git fetch origin main staging --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}
50
+ cd Mobile-Expensify
51
+ git fetch origin main staging --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}
44
52
45
- - name : Get version bump commit
53
+ - name : Get E/App version bump commit
46
54
id : getVersionBumpCommit
47
55
run : |
48
56
git switch main
49
- VERSION_BUMP_COMMIT="$(git log --format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
57
+ VERSION_BUMP_COMMIT="$(git log -1 - -format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
50
58
if [ -z "$VERSION_BUMP_COMMIT" ]; then
51
- echo "::error::❌ Could not find version bump commit for ${{ needs.createNewVersion.outputs.NEW_VERSION }}"
59
+ echo "::error::❌ Could not find E/App version bump commit for ${{ needs.createNewVersion.outputs.NEW_VERSION }}"
52
60
git log --oneline
53
61
else
54
- echo "::notice::👀 Found version bump commit $VERSION_BUMP_COMMIT"
62
+ echo "::notice::👀 Found E/App version bump commit $VERSION_BUMP_COMMIT"
55
63
fi
56
64
echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT"
57
65
58
- - name : Get merge commit for pull request to CP
66
+ - name : Get Mobile-Expensify version bump commit
67
+ id : getMobileExpensifyVersionBumpCommit
68
+ working-directory : Mobile-Expensify
69
+ run : |
70
+ git switch main
71
+ VERSION_BUMP_COMMIT="$(git log -1 --format='%H' --author='OSBotify' --grep 'Update version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}')"
72
+ if [ -z "$VERSION_BUMP_COMMIT" ]; then
73
+ echo "::error::❌ Could not find Mobile-Expensify version bump commit for ${{ needs.createNewVersion.outputs.NEW_VERSION }}"
74
+ git log --oneline
75
+ else
76
+ echo "::notice::👀 Found Mobile-Expensify version bump commit $VERSION_BUMP_COMMIT"
77
+ fi
78
+ echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT"
79
+
80
+ - name : Get merge commit for E/App pull request to CP
59
81
id : getCPMergeCommit
60
82
uses : ./.github/actions/javascript/getPullRequestDetails
61
83
with :
62
84
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63
85
USER : ${{ github.actor }}
64
86
PULL_REQUEST_NUMBER : ${{ github.event.inputs.PULL_REQUEST_NUMBER }}
65
87
66
- - name : Cherry-pick the version-bump to staging
88
+ - name : Cherry-pick the Mobile-Expensify version bump to Mobile-Expensify staging
89
+ working-directory : Mobile-Expensify
90
+ run : |
91
+ git switch staging
92
+ git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getMobileExpensifyVersionBumpCommit.outputs.VERSION_BUMP_SHA }}
93
+ git push origin staging
94
+
95
+ - name : Update the Mobile-Expensify submodule on E/App staging
96
+ run : |
97
+ git add Mobile-Expensify
98
+ git commit -m "Update Mobile-Expensify submodule version to ${{ needs.createNewVersion.outputs.NEW_VERSION }}"
99
+
100
+ - name : Cherry-pick the E/App version-bump to staging
67
101
run : |
68
102
git switch staging
69
103
git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }}
0 commit comments