File size: 1,872 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
#!/bin/bash

CALYPSO_DIR=$(cd $(dirname $0)/../../ && pwd)

# desktop tags
function get_desktop_tags() {
  desktop_tags=""
  declare -i x=0
  for tag in $(git tag); do
    # guard against stray v9.9.9 test tag that keeps being re-introduced to the repo! ಠ_ಠ
    if [[ "$tag" == *"9.9.9" ]]; then
      continue;
    fi

    if [[ $tag == desktop-v* ]]; then
      if [ $x -gt 0 ]; then
        desktop_tags="$desktop_tags"$'\n'"$tag"
      else
        desktop_tags="$tag"
      fi
    fi
    x+=1
  done
  echo "$desktop_tags"
}

# fetch all tags in descending lexicographical order
# (exclude current tag with `awk`)
all_tags=$(get_desktop_tags | tr - \~ | sort -V -r | tr \~ -)
tags=$all_tags
if [ ! -z "$VERSION" ]; then
  tags=$(echo "$all_tags" | awk '{if( !(/^'"$VERSION"'/) )print}')
fi

# get tag for previous stable release from the sorted list
# (first match without `-`, e.g. v1.2.3, not v1.2.3-alpha1)
last_stable_tag=$(for tag in $tags; do if [[ ! "$tag" == *"alpha"* && ! "$tag" == *"beta"* ]]; then
  echo "$tag"
  break
fi; done)

# get the current tag, fall back to HEAD
current_tag=$VERSION
if [ -z "$current_tag" ]; then
  current_tag=HEAD
fi

# Include commit message (%s). Other elements such as
# commit author (_%aN_) and commit short hash (%h) can
# be included if desired.
git_log_format="%s"

echo "## Latest Changes"
echo ""

# Fill and sort changelog (final sort in commit-date order)
git_log=$(git log --oneline --pretty=format:"$git_log_format" $last_stable_tag...$current_tag -- "$CALYPSO_DIR/desktop/" "$CALYPSO_DIR/client/lib/desktop-listeners" "$CALYPSO_DIR/client/desktop")

if [ ! -z "$git_log" ]; then
  echo "$git_log" | while IFS=$'\r' read change; do
    # Don't include application version bump commits
    awk '$0 !~ /([0-9])+\.([0-9])+\.([0-9])+/ {print "* " $0}' <<< $change
  done
else
  echo "No changes"
fi

printf "\n"