11name : Publish React Native Android Artifacts
22
33on :
4+ workflow_dispatch :
5+ inputs :
6+ build_standalone :
7+ description : ' Build Standalone artifacts'
8+ required : false
9+ type : boolean
10+ build_hybridapp :
11+ description : ' Build HybridApp artifacts'
12+ required : false
13+ type : boolean
414 push :
515 branches :
616 - main
@@ -23,20 +33,23 @@ jobs:
2333 uses : actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
2434 with :
2535 submodules : true
26- ref : ${{ github.event.before }}
36+ ref : ${{ github.event.before || 'main' }}
2737 token : ${{ secrets.OS_BOTIFY_TOKEN }}
2838
2939 - name : Get previous patches hash
40+ if : ${{ github.event_name != 'workflow_dispatch' }}
3041 id : getOldPatchesHash
3142 run : |
3243 echo "HYBRID_APP_HASH=$(./scripts/compute-patches-hash.sh patches Mobile-Expensify/patches)" >> "$GITHUB_OUTPUT"
3344 echo "STANDALONE_APP_HASH=$(./scripts/compute-patches-hash.sh patches)" >> "$GITHUB_OUTPUT"
3445
3546 - name : Get previous react-native version
47+ if : ${{ github.event_name != 'workflow_dispatch' }}
3648 id : getOldVersion
3749 run : echo "VERSION=$(jq -r '.dependencies["react-native"]' package.json)" >> "$GITHUB_OUTPUT"
3850
3951 - name : Checkout new ref
52+ if : ${{ github.event_name != 'workflow_dispatch' }}
4053 run : |
4154 git fetch origin ${{ github.event.after }} --depth=1
4255 git checkout ${{ github.event.after }}
@@ -49,10 +62,12 @@ jobs:
4962 echo "STANDALONE_APP_HASH=$(./scripts/compute-patches-hash.sh patches)" >> "$GITHUB_OUTPUT"
5063
5164 - name : Get new react-native version
65+ if : ${{ github.event_name != 'workflow_dispatch' }}
5266 id : getNewVersion
5367 run : echo "VERSION=$(jq -r '.dependencies["react-native"]' package.json)" >> "$GITHUB_OUTPUT"
5468
5569 - name : Check if version changed
70+ if : ${{ github.event_name != 'workflow_dispatch' }}
5671 id : didVersionChange
5772 run : |
5873 readonly DID_VERSION_CHANGE=${{ steps.getOldVersion.outputs.VERSION != steps.getNewVersion.outputs.VERSION && 'true' || 'false' }}
6277 fi
6378
6479 - name : Check if patches changed
80+ if : ${{ github.event_name != 'workflow_dispatch' }}
6581 id : didPatchesChange
6682 run : |
6783 readonly DID_HYBRID_APP_PATCHES_CHANGE=${{ steps.getOldPatchesHash.outputs.HYBRID_APP_HASH != steps.getNewPatchesHash.outputs.HYBRID_APP_HASH && 'true' || 'false' }}
8096 - name : Get artifact build targets
8197 id : getArtifactBuildTargets
8298 run : |
99+ if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
100+ BUILD_TARGETS=()
101+
102+ if [[ '${{ inputs.build_standalone }}' == 'true' ]]; then
103+ BUILD_TARGETS+=(false)
104+ fi
105+
106+ if [[ '${{ inputs.build_hybridapp }}' == 'true' ]]; then
107+ BUILD_TARGETS+=(true)
108+ fi
109+
110+ if [[ ${#BUILD_TARGETS[@]} -ne 0 ]]; then
111+ echo "BUILD_TARGETS=$(printf '%s\n' "${BUILD_TARGETS[@]}" | jq -R . | jq -c -s .)" >> "$GITHUB_OUTPUT"
112+ fi
113+ exit 0
114+ fi
115+
83116 # When there is a version change or standalone app patches change, we need to build for both hybrid and standalone
84117 if [[ '${{ steps.didVersionChange.outputs.DID_VERSION_CHANGE }}' == 'true' || '${{ steps.didPatchesChange.outputs.DID_STANDALONE_APP_PATCHES_CHANGE }}' == 'true' ]]; then
85118 echo "BUILD_TARGETS=[\"true\", \"false\"]" >> "$GITHUB_OUTPUT"
0 commit comments