-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.sh
executable file
·64 lines (52 loc) · 1.88 KB
/
step.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
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e
set -x
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $THIS_SCRIPT_DIR
npm install
gem install --no-document redcarpet
cd $BITRISE_SOURCE_DIR
if [ "$TAG_DEST" = "HEAD" ]; then
tag_head=$(git tag --points-at HEAD)
if [[ "$BITRISE_GIT_BRANCH" =~ (develop|master|release) ]]; then
previousTag=$(git rev-list --parents HEAD | head -1| cut -d' ' -f2)
else
base_branch="develop"
if [ -n "$BITRISEIO_GIT_BRANCH_DEST" ]; then
base_branch=$BITRISEIO_GIT_BRANCH_DEST
fi
previousTag=$(git merge-base $BITRISE_GIT_BRANCH $BITRISEIO_GIT_BRANCH_DEST)
fi
if [ -n "$tag_head" ]; then
TAG_DEST=$tag_head
fi
fi
if [ "$TAG_DEST" != "HEAD" ]; then
git -c core.hooksPath=/dev/null checkout ${TAG_DEST}~1
previousTag=$(git describe --tags --abbrev=0)
fi
git -c core.hooksPath=/dev/null checkout ${TAG_DEST}
if [ -n "$CHANGE_FILE" ] ; then
if [ -z "$(git config user.name)" ]; then
git config user.email $IC_COMMITER_MAIL
git config user.name $IC_COMMITER_NAME
fi
touch $CHANGE_FILE
ALREADY="$(grep "^# ${TAG_DEST}" $CHANGE_FILE || true)"
# or ALREADY = tag <> HEAD
if [ -z "$ALREADY" ]; then
$THIS_SCRIPT_DIR/changelog.js $TAG_DEST "${CHANGE_FILE}" $previousTag
if $CI ; then
GIT_ASKPASS=echo
GIT_SSH="${THIS_SCRIPT_DIR}/ssh_no_prompt.sh"
git add $CHANGE_FILE
git commit -m "chore(${TAG_DEST}):update changes [skip ci]"
git push origin HEAD:$BITRISE_GIT_BRANCH
fi
fi
fi
#git log --invert-grep --grep="^Merge" -E --format=%H%n%s%n%b%n%an%n==END== ${previousTag}..${TAG_DEST}
changelog=$($THIS_SCRIPT_DIR/changelog.js $TAG_DEST '' $previousTag --lite)
changelog_final=$(echo "$($THIS_SCRIPT_DIR/changelog.js $TAG_DEST '' $previousTag --lite)")
$THIS_SCRIPT_DIR/to_html.rb --md "${changelog}" > changelog.html
envman add --key CHANGELOG --value "${changelog_final}"