Public install page URLs for multiple apps

#1

I have created a workflow that successfully outputs both an iOS and Android app from a single project. I am trying to add a step that notifies our team Slack channel of a successful build with links to the public install page URLs for both the iOS and Android apps. Currently, I can only seem to get one URL, the one stored in $BITRISE_PUBLIC_INSTALL_PAGE_URL. Is there a way to output multiple install page URLs?

2 Likes

#2

Hi @clee46,

Thanks for asking this here! :wink:

So, based on what you wrote, you most likely have one Deploy to Bitrise.io step in your workflow, and two different steps which create the apps (Xcode Archive for iOS and Gradle Runner (?) for Android).

To have separate URLs for both, the trick is that you can add more than one Deploy to Bitrise.io steps, and change the Deploy directory or file path (deploy_path) input of the steps from the default $BITRISE_DEPLOY_DIR, one to the path of the APK and one to the path of the IPA. In the Workflow Editor you can click into this input and then click on the “Insert Variable” button which appears, that’ll give you a full list of available env vars you can use (e.g. Xcode Archive exports the IPA path as BITRISE_IPA_PATH).

There’s one more step, as even if you have two, separate Deploy to Bitrise.io steps, both will write its output into the same env var (BITRISE_PUBLIC_INSTALL_PAGE_URL), the second overwriting the vaule of the first one.

It’s on our roadmap to provide a built in solution for this problem, so that you can change the env var’s name where the step stores its output - EDIT this is now supported, since Bitrise CLI 1.6.0; example:

    steps:
    - deploy-to-bitrise-io:
        inputs:
        - deploy_path: file/path/one
        outputs:
        - BITRISE_PUBLIC_INSTALL_PAGE_URL: FIRST_INSTALL_PAGE
    - deploy-to-bitrise-io:
        inputs:
        - deploy_path: file/path/two
        outputs:
        - BITRISE_PUBLIC_INSTALL_PAGE_URL: SECOND_INSTALL_PAGE

Previous solution, before the built in output alias support:

It’s on our roadmap to provide a built in solution for this problem, so that you can change the env var’s name where the step stores its output, right now you’ll have to use a Script step after the first Deploy to Bitrise.io step to copy the value of BITRISE_PUBLIC_INSTALL_PAGE_URL into another env var. You can find more info about our proposal here: Output from multiple instances of the same step (“How to reference outputs of separate steps which expose outputs with the same environment variable key”), and a solution which you can do right now (using a Script step) here: How to override environment variables through the Build Trigger API

TL;DR; add a Script step right after the output is generated (in this case after the first Deploy to Bitrise.io step) and “copy” the value of that output into another env var using envman. E.g.:

#!/bin/bash
set -ex
envman add --key MY_APK_INSTALL_PAGE_URL --value "$BITRISE_PUBLIC_INSTALL_PAGE_URL"

After this in subsequent steps you can access $MY_APK_INSTALL_PAGE_URL and get the value of the first Deploy to Bitrise.io step. You can repeat this for the second deploy step too if you want to have a more descriptive env var for your Slack message (e.g. MY_APK_INSTALL_PAGE_URL & MY_IPA_INSTALL_PAGE_URL), or simply reference the second/last deploy step’s output with the default $BITRISE_PUBLIC_INSTALL_PAGE_URL env var.

I hope this helps, and hopefully we can release the built in solution in the near future, until that if you have any questions just let us know! :wink:

2 Likes

BITRISE PUBLIC INSTALL PAGE URL showing only unsigned apk
BITRISE PUBLIC INSTALL PAGE URL showing only unsigned apk
Hybrid - Create new variables with public url to each platform
Generate two install urls
#3

Hi @viktorbenei,

Thanks for the prompt reply! Your solution worked for me! I’ve clarified a little bit of the context below for other users.

Originally, I had a single Xamarin Archive step creating both iOS and Android builds (in the step config, specifed ‘ios, android’ under the projects to build). The problem was that the single Deploy to Bitrise step only creates a single $BITRISE_PUBLIC_INSTALL_PAGE_URL env var.

To solve, I created two Xamarin Archive steps, one configured to build only the ios project and the other only the android project. I then followed @viktorbenei’s solution exactly. So my final workflow looks like this:

Xamarin Archive (builds Android only) -> Sign APK -> Deploy to Bitrise -> Script (saves the Android install page URL) -> Xamarin Archive (builds iOS only) -> Deploy to Bitrise -> Send Slack message (now has access to both Android and iOS install page URLs!)

Thanks so much, @viktorbenei!

2 Likes

#4

Awesome, thanks for sharing the details @clee46, I’m sure it’ll help others too! :wink:

Just one note: you don’t need two separate Xamarin Archive steps. You can, so what you described definitely works, just wanted to mention that if the Xamarin Archive step generates both an IPA and an APK it’ll set env vars to both files’ paths (BITRISE_APK_PATH and BITRISE_IPA_PATH). You can find the full list of outputs the Xamarin Archive step can generate at:

1 Like