Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Created February 25, 2016 19:48
Show Gist options
  • Save sjehutch/355e9ce1776393291021 to your computer and use it in GitHub Desktop.
Save sjehutch/355e9ce1776393291021 to your computer and use it in GitHub Desktop.
hockeyapp.sh
#!/usr/bin/env bash
# Remove this if you want deployment for every pull request.
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "This is a pull request. No deployment will be done."
exit 0
fi
# This will only deploy if your main branch is develop.
if [[ "$TRAVIS_BRANCH" != "develop" ]]; then
echo "Testing on a branch other than develop. No deployment will be done."
exit 0
fi
RELEASE_DATE=`date '+%Y-%m-%d'`
DEV_BUILD_NAME="DEBUG"
DEVELOP_BRANCH_NAME="-DEVELOP-"
BUILD_DATE="$RELEASE_DATE"
BUILD_NAME="$DEV_BUILD_NAME+$DEVELOP_BRANCH_NAME+$BUILD_DATE"
RELEASE_NOTES="Build: $TRAVIS_BUILD_NUMBER\nUploaded: $RELEASE_DATE"
echo "Release notes: $RELEASE_NOTES"
echo "Uploading: app-release.apk"
# here the apk built by android studio is app-release.apk, if your build script generates anything different
# you want to make sure you enter that name includng the extension here.
# replace <YOUR_HOCKEY_APP_TOKEN> with your hockey app token.
curl \
-F "status=2" \
-F "notify=1" \
-F "notes=$RELEASE_NOTES" \
-F "notes_type=0" \
-F "ipa=@$TRAVIS_BUILD_DIR/app/build/outputs/apk/app-release.apk" \
-H "X-HockeyAppToken: <HOKCYE_APP_APT_TOKEN_HERE>" \
https://rink.hockeyapp.net/api/2/apps/upload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment