Skip to content

Commit

Permalink
Add notifyTesters option (#16)
Browse files Browse the repository at this point in the history
* Add notifyTesters option that will remove the --silent flag

* specify bash on entrypoint

* add bash to dockerfile

* Sort releases in reverse numeric order

* Fix parameters on sort
  • Loading branch information
tmorone-rezi authored Aug 12, 2020
1 parent e8cbbe0 commit 785f7cc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ COPY . /app

RUN npm install -g appcenter-cli@2.5.4 \
&& apk update \
&& apk add git
&& apk add git \
&& apk add bash

RUN chmod +x /app/entrypoint.sh

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ This action uploads artefacts (.apk or .ipa) to Visual Studio App Center.

Release notes visible on release page


### `gitReleaseNotes`

Generate release notes based on the latest git commit

### `notifyTesters`

If set to true, an email notification is sent to the distribution group

## Example usage

Expand Down Expand Up @@ -60,4 +62,5 @@ jobs:
token: ${{secrets.APP_CENTER_TOKEN}}
group: Testers
file: app/build/outputs/apk/release/app-release-unsigned.apk
notifyTesters: true
```
27 changes: 15 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
name: 'App Center'
description: 'GitHub Action that uploads artefacts for Visual Studio App Center'
author: 'Wojciech Zięba <@wzieba>'
name: "App Center"
description: "GitHub Action that uploads artefacts for Visual Studio App Center"
author: "Wojciech Zięba <@wzieba>"
inputs:
appName:
description: 'App name followed by username e.g. wzieba/Sample-App'
description: "App name followed by username e.g. wzieba/Sample-App"
required: true
token:
description: 'Upload token - you can get one from appcenter.ms/settings'
description: "Upload token - you can get one from appcenter.ms/settings"
required: true
group:
description: 'Distribution group'
description: "Distribution group"
required: true
file:
description: 'Artefact to upload (.apk or .ipa)'
description: "Artefact to upload (.apk or .ipa)"
required: true
releaseNotes:
description: 'Release notes visible on release page'
description: "Release notes visible on release page"
required: false
gitReleaseNotes:
description: "Generate release notes based on the latest git commit"
required: false
notifyTesters:
description: "If true, send an email notification to the distribution group"
required: false
branding:
color: 'red'
icon: 'send'
color: "red"
icon: "send"
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
10 changes: 6 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/sh
#!/bin/bash
RELEASE_NOTES=""
isFirst=true
releaseId=""
export IFS=";"
params=()
[ "${INPUT_NOTIFYTESTERS}" != true ] && params+=(--silent)
if [ -n "${INPUT_RELEASENOTES}" ]; then
RELEASE_NOTES=${INPUT_RELEASENOTES}
elif [ $INPUT_GITRELEASENOTES ]; then
Expand All @@ -11,9 +13,9 @@ fi
for group in $INPUT_GROUP; do
if ${isFirst} ; then
isFirst=false
appcenter distribute release --token "$INPUT_TOKEN" --app "$INPUT_APPNAME" --group $group --file "$INPUT_FILE" --release-notes "$INPUT_RELEASENOTES" --silent
releaseId=$(appcenter distribute releases list --token "$INPUT_TOKEN" --app "$INPUT_APPNAME" | grep ID | head -1 | tr -s ' ' | cut -f2 -d ' ')
appcenter distribute release --token "$INPUT_TOKEN" --app "$INPUT_APPNAME" --group $group --file "$INPUT_FILE" --release-notes "$INPUT_RELEASENOTES" "${params[@]}"
releaseId=$(appcenter distribute releases list --token "$INPUT_TOKEN" --app "$INPUT_APPNAME" | grep ID | tr -s ' ' | cut -f2 -d ' ' | sort -n -r | head -1)
else
appcenter distribute releases add-destination --token "$INPUT_TOKEN" -d $group -t group -r $releaseId -s --app "$INPUT_APPNAME"
appcenter distribute releases add-destination --token "$INPUT_TOKEN" -d $group -t group -r $releaseId --app "$INPUT_APPNAME" "${params[@]}"
fi
done

0 comments on commit 785f7cc

Please sign in to comment.