From 9d013b6a626b6217b18af59aa3b5fc9e39dfbf54 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Mon, 9 Sep 2024 20:41:40 +0530 Subject: [PATCH] TP-71465 | Error handling in generate apk action --- .github/workflows/newBuild.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/newBuild.yml b/.github/workflows/newBuild.yml index 558b1cdf..019146ca 100644 --- a/.github/workflows/newBuild.yml +++ b/.github/workflows/newBuild.yml @@ -130,10 +130,18 @@ jobs: ls - chmod +r ./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{github.event.inputs.flavor}}${{github.event.inputs.environment}}-release.apk + apk_path="./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}-release.apk" + + # Check if APK exists, exit if not + if [ ! -f "$apk_path" ]; then + echo "Error: APK file not found at $apk_path" + exit 1 + fi + + chmod +r "$apk_path" curl --location --request PUT "$upload_url" \ - --data-binary "@./android/app/build/outputs/apk/${{ github.event.inputs.flavor || inputs.flavor }}${{github.event.inputs.environment || inputs.environment}}/${{github.event.inputs.type || inputs.type}}/app-fieldAgentsQA-release.apk" + --data-binary "@$apk_path" echo "upload compleate"