-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathci_success.sh
executable file
·50 lines (42 loc) · 1.26 KB
/
ci_success.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# cut latest tag - based on changelog
# issue a GitHub release
function release {
# TODO git config user/email
# get tag and release notes from changelog
FILE=CHANGELOG.md
MESSAGES=()
BODY=""
k=1
while read line; do
if [[ $k = 1 ]]; then
# capture release version - for tag
RELEASE="$line"
RELEASE=${RELEASE:3}
elif [ -z "$line" ]; then
# stop on previous release
break
else
# keep change for tag
MESSAGES+=("-m \"$line\"")
BODY+="$line\n"
fi
((k++))
done < $FILE
# annotated tag and messages
TAG="git tag -a v$RELEASE -m \"v$RELEASE\""
ANNOTATIONS="${MESSAGES[@]}"
# issue tag and push
COMMAND="${TAG} ${ANNOTATIONS}"
eval $COMMAND
git push origin --tags
# create GitHub release
RELEASE_JSON="{\"tag_name\": \"v${RELEASE}\", \"target_commitish\": \"master\", \"name\": \"v${RELEASE}\", \"body\": \"${BODY}\"}"
# issue github release
curl --data "$RELEASE_JSON" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/jonpitch/danger-brewing/releases?access_token=$GH_ACCESS_TOKEN
}
#!/bin/bash
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "not yet implemented"
# ensure CI finishes successfully
exit 0
fi