2

We use Fastlane for our App build and we want to be able to do a consistent staging build on our CI server or on a local machine.

Since we publish all builds on Hockeyapp we thought about retrieving the highest build number for our app from the Hockeyapp API and then increase this by one.

How do I get access to the build number from Fastlane?

Janusz
  • 187,060
  • 113
  • 301
  • 369

3 Answers3

2

I actually found a way.

There is a plugin for fastlane for this fastlane-plugin-latest_hockeyapp_version_number

You can add this plugin with fastlane add_plugin latest_hockeyapp_version_number

After that you get the latest version number with this call:

build_number = latest_hockeyapp_version_number(
   api_token: "Your API Token, needs full access for your app on Hockey",
   app_name: "The App Name",
   platform: 'Platform', # iOS, Android, Mac OS, Windows Phone, Custom
   release_type: '0' # 0 = Beta (default), 1 = Store, 2 = Alpha, 3 = Enterprise"
) 
Erich
  • 2,743
  • 1
  • 24
  • 28
Janusz
  • 187,060
  • 113
  • 301
  • 369
1

Currently this is not available using the HockeyApp action with fastlane. We would definitely be open to reviewing a PR on GitHub if you would be interested in contributing!

ohayon
  • 381
  • 1
  • 4
  • 16
0

Instead of finding out the build number, when you upload a build to Hockey you can directly fetch the URL of the latest build and that you can share in the email so that QA and others can directly download the build using that link. You can achieve this by executing a shell script file.

JSON=$( curl https://rink.hockeyapp.net/api/2/apps/$HOCKEY_APP_ID/app_versions \
        -F status="2" \
  -F notify="0" \
  -F notes="$RELEASE_NOTES" \
  -F notes_type="0" \
  -F tags="beta" \
  -F ipa="@$OUTPUTDIR/$APP_NAME.ipa/$APP_NAME.ipa" \
  -H "X-HockeyAppToken: $HOCKEY_APP_TOKEN"
)

URL=$( echo ${JSON} | sed 's/\\\//\//g' | sed -n 's/.*"public_url"\s*:\s*"\([^"]*\)".*/\1/p' )
Anuj Panwar
  • 683
  • 7
  • 10