forked from stealthcopter/AndroidNetworkTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·29 lines (22 loc) · 1.17 KB
/
config.sh
File metadata and controls
executable file
·29 lines (22 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
ENV_VAR_PREFIX="ANDROID_NETWORK_TOOLS"
# Slack webhook settings
SLACK_CHANNEL="#mat-testing"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"
ICON_URL="https://github.com/stealthcopter/AndroidNetworkTools/raw/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png"
# Git info
GIT_URL="https://github.com/stealthcopter/AndroidNetworkTools"
GIT_TAG=`git name-rev --name-only --tags HEAD`
GIT_COMMIT_DESC=`git log -n 1 $CIRCLE_SHA1`
GIT_CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
# Fires a webhook to slack to notify of successful upload to beta
function webhook {
gradle_app_name="$1"
app_name="$2"
message="$3"
git_hash=`git rev-parse --short HEAD`
version=`cat ${gradle_app_name}/build.gradle | grep -m 1 versionName | cut -d'"' -f 2`
echo $message
echo $channel $gradle_app_name $app_name $version $ICON_URL
curl -X POST --data-urlencode 'payload={"channel": "'"$SLACK_CHANNEL"'", "username": "CirclCI Deployment Bot", "text": "*'"$app_name"'* version *'"$version"'* <'"$GIT_URL/commits/$git_hash"'|'"$git_hash"'> '"$message"'", "icon_url": "'"$ICON_URL"'"}' $SLACK_WEBHOOK_URL
}