Appcenter-cli: Allow "appcenter distribute release -g" to send to multiple group

Created on 1 Oct 2019  Â·  11Comments  Â·  Source: microsoft/appcenter-cli

Hello,
is it possible to consider to add this option to upload to multiple groups with the appcenter distribute release command ?
Or maybe there is a possibility with the -g option but I didn't find it.

Currently it's possible to do this with the open API by using :
curl -X PATCH "https://api.appcenter.ms/v0.1/apps/${OWNERNAME}/${APPNAME}/releases/${LASTEST_RELEASEID}" -H "accept: application/json" -H "X-API-Token:${APPCENTER_TOKEN}" -H "Content-Type: application/json" -d '{ "release_notes": "${RELEASENOTES}", "mandatory_update": false, $DISTRIBUTIONS_JSON, "notify_testers": false}'

so I think it could be achieved with appcenter-cli version ?
I mean nobody want to patch the app after submitting (distribute release) an application with a group option that will managed only one group.

And currently it's impossible to update the application groups with the appcenter apps update command anyway :)

I just see a ticket has been closed month ago with the same issue #467 but for me it's not really convenient to switch from one method to another (CLI / API) my main concern is to do only one method.

My explanations :

Because last week I implement really quickly CLI version of our old hockeyapp pipeline. Then I saw it wasn't possible to not notify people.

So I switched to API system, today it was almost over when I realized it was really not convenient to upload a dSym.zip file cause ours are above 256MB and the silent option for release was out last night.

So I switched back to CLI system, integrate the --silent during distribute release process. But then I figure out it was not possible to upload it to multiple group and moreover it's impossible to update it after with the apps update method.

HockeyApp will be dropped within a month (roughly) and the switch is not currently smooth as it must be (according to me). In fact, I don't care if I need to spend a week to switch from one system to another as soon as I don't have to implement X system (CLI AND API) to do what was simple to do with HockeyApp previously.

Distribute feature-request

Most helpful comment

After my suggestion I used the command you suggest @phillipleblanc (so I think it was the good thing to do as a backup solution) but I encountered another issue if you have a solution for this too.
How can I retrieve the last release ID (most updated release version for an app) with CLI ?

But on the initial topic, I think it could be nice to have this option in the basic upload command. And having the one you suggest (and I used) is good too.

All 11 comments

Thanks for opening this issue @liszto! You should be able to achieve your scenario with the appcenter distribute releases add-destination command. The help text for that command looks like this:

➜ appcenter help distribute releases add-destination

Distribute an existing release to an additional destination

Usage: appcenter distribute releases add-destination -d|--destination <arg> -t|--type <arg> -r|--release-id <arg> [-s|--silent] [-m|--mandatory] [-a|--app <arg>]

Options:
    -d|--destination <arg>             The name of the store or group, or the email of the tester
    -t|--type <arg>                    The type of destination: [store, group, tester]
    -r|--release-id <arg>              The ID of the release
    -s|--silent                        If set, do not send a notification to the testers (Not used for stores)
    -m|--mandatory                     Whether the release is mandatory for the testers (Not used for stores)
    -a|--app <arg>                     Specify app in the <ownerName>/<appName> format

After my suggestion I used the command you suggest @phillipleblanc (so I think it was the good thing to do as a backup solution) but I encountered another issue if you have a solution for this too.
How can I retrieve the last release ID (most updated release version for an app) with CLI ?

But on the initial topic, I think it could be nice to have this option in the basic upload command. And having the one you suggest (and I used) is good too.

To get recent release ID use below command:
appcenter distribute releases list --app "$owner"/"$appname" | grep ID | head -1

@pradeepvimal I already did this :)
I just did update this topic with the command due to the unrelated topic wuth my initial post.

Improving the command to get the release ID (this one will give you the number on its own):

appcenter distribute releases list --app "$owner"/"$appname" | grep ID | head -1 | tr -s ' ' | cut -f2 -d ' '

Adding tr -s ' ' | cut -f2 -d ' ' will transform

ID            12

to

12

Improving the command to get the release ID (this one will give you the number on its own):

appcenter distribute releases list --app "$owner"/"$appname" | grep ID | head -1 | tr -s ' ' | cut -f2 -d ' '

Adding tr -s ' ' | cut -f2 -d ' ' will transform

ID            12

to

12

Good solution.
By the way, where do you get the above flags? (grep, head ...etc)

By the way, where do you get the above flags? (grep, head ...etc)

I am not sure to understand your question. If you're familiar with the command line you may know about them already (and use man tr for example), but otherwise, there is a lot of online resources about the unix command line and the text manipulation.
It takes a bit of googling sometimes as well to find the correct solution if you're not using those that often (like me).

Im new to all this, especially AppCenter CLI so very appreciated your comments.
Here is my command file using @fabiendem's solution for anyone who is still learning like me:

appcenter distribute release -a $APPNAME  -r "Release Notes Here" -g "$GROUP_NAME" -f "$FILE_PATH" --token $APP_TOKEN
LATEST_VERSION="$(appcenter distribute releases list --app $APPNAME --token $APP_TOKEN | grep ID | head -1| tr -s ' ' | cut -f2 -d ' ')"
#echo $LATEST_VERSION
appcenter distribute releases add-destination -a $APPNAME -d $ANOTHER_GROUP_NAME -t group -r $LATEST_VERSION --token $APP_TOKEN

For powershell users:

appcenter distribute release --group "Collaborators" --file "dist/${apkName}" --release-notes ${appCenterReleaseNotes} --app "$org/${appCenterAppName}" --token ${appCenterToken}
${appCenterReleasesMatches} = appcenter distribute releases list --app "$org/${appCenterAppName}" --token ${appCenterToken} | Select-String -Pattern "^ID:\s*(\d+)" | Select -First 1
${appCenterLastReleaseId} = ${appCenterReleasesMatches}[0].Matches[0].Groups[1].Value
echo "Last release id = ${appCenterLastReleaseId}"
appcenter distribute releases add-destination --type group --destination "SoB" --release-id ${appCenterLastReleaseId} --app "$org/${appCenterAppName}" --token ${appCenterToken}

The lack of setting multiple groups while creating a release with the CLI was the major obstacle while trying to replace the deprecated Release API uploads.

Definitely need updated CLI to release to multiple groups.

Was this page helpful?
0 / 5 - 0 ratings