Location of android apk after CircleCI build

I am setting up circle CI for the first time. I am trying to write a script to upload the apk to hockeyapp after the build is done. I read some threads here and came up with this code for my script

curl \
-F "status=2" \
-F "notify=0" \
-F "ipa=@/root/code/app/build/outputs/apk/release/app-universal-release-unsigned.apk" \
-H "X-HockeyAppToken: $HockeyAppToken" \
https://rink.hockeyapp.net/api/2/apps/upload

However, Circle CI complains that the path is not correct

curl: (26) couldn’t open file “/root/code/app/build/outputs/apk/release/app-universal-release-unsigned.apk”
Exited with code 26

Is there a way I can know the exact location of the android apk created by Circle CI?

Also, I want to upload the apk to hockeyapp only for the master branch and release branches matching the name release/. Will the below code work for that?

if [ "${CIRCLE_BRANCH}" == "release/*" ] || [ "${CIRCLE_BRANCH}" == "master" ];
  then sh hockey_deploy.sh;
fi

Thank you!

The location is not defined by CircleCI. It is defined by your build scripts. Wherever this is being saved when you build locally should be the same path on the CircleCI side (relative to your project root).

That didn’t work for me, but this did:

export B=release/123

if [[ $B == *release/* ]]; then echo "yay"; else echo "nay"; fi;

Notice double [[ ]] and using * instead of quotes.

Thanks @levlaz

Thanks for the help ! :slight_smile:

1 Like