Issue
I am trying to upload app-release.apk
file from https://appcenter.ms/ to s3 bucket using curl
command through appcenter post-build
script but getting this error curl: (26) Failed to open/read local data from file/application
here is my complete post-build
script
File_name: appcenter-post-build.sh
if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then
# Example: Upload main branch app binary to HockeyApp using the API
echo "Current branch is $APPCENTER_BRANCH"
if [ "$APPCENTER_BRANCH" == "staging" ];
then
curl \
-F "status=2" \
-F "file_stage=@$APPCENTER_OUTPUT_DIRECTORY/app-release.apk" \
https://stag.api.website.com/v1/upload/android
# curl --location 'https://stag.api.website.com/v1/upload/android' \
# --form 'file_stage=@"$APPCENTER_OUTPUT_DIRECTORY/app-release.apk"'
else
echo "Current branch is $APPCENTER_BRANCH"
fi
fi
Solution
I am able to resolve this issue by replace the file path name from $APPCENTER_OUTPUT_DIRECTORY/app-release.apk
to /Users/runner/work/1/s/android/app/build/outputs/apk/release/app-release.apk
My final working codes are
if [ "$AGENT_JOBSTATUS" == "Succeeded" ]; then
# Example: Upload main branch app binary to HockeyApp using the API
echo "Current branch is $APPCENTER_BRANCH"
if [ "$APPCENTER_BRANCH" == "staging" ];
then
curl \
-F "status=2" \
-F "file_stage=@/Users/runner/work/1/s/android/app/build/outputs/apk/release/app-release.apk" \
-H 'Authorization: Bearer token' \
https://stag.api.website.com/v1/upload/android
else
echo "Current branch is $APPCENTER_BRANCH"
fi
fi
Answered By - Avinash A Answer Checked By - David Goodson (WPSolving Volunteer)