Skip to content

Commit fd04ed4

Browse files
committed
Added autogenerated release notes from commits
1 parent d82e34c commit fd04ed4

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.travis.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,45 @@ before_deploy:
6363
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
6464
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
6565
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
66+
- echo "littlefs version $LFS_VERSION"
6667
- |
6768
curl -u $GEKY_BOT -X POST \
6869
https://github.com/api/repos/$TRAVIS_REPO_SLUG/git/refs \
69-
-d @- <<< "{
70+
-d "{
7071
\"ref\": \"refs/tags/$LFS_VERSION\",
7172
\"sha\": \"$TRAVIS_COMMIT\"
7273
}"
7374
- |
7475
curl -f -u $GEKY_BOT -X PATCH \
7576
https://github.com/api/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
76-
-d @- <<< "{
77+
-d "{
7778
\"sha\": \"$TRAVIS_COMMIT\"
7879
}"
80+
# Create release notes from commits
81+
- LFS_PREV_VERSION="v$LFS_VERSION_MAJOR.$(($LFS_VERSION_MINOR-1))"
82+
- |
83+
if [ $(git tag -l "$LFS_PREV_VERSION") ]
84+
then
85+
curl -u $GEKY_BOT -X POST \
86+
https://github.com/api/repos/$TRAVIS_REPO_SLUG/releases \
87+
-d "{
88+
\"tag_name\": \"$LFS_VERSION\",
89+
\"name\": \"$LFS_VERSION\"
90+
}"
91+
RELEASE=$(
92+
curl -f https://github.com/api/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
93+
)
94+
CHANGES=$(
95+
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
96+
)
97+
curl -f -u $GEKY_BOT -X PATCH \
98+
https://github.com/api/repos/$TRAVIS_REPO_SLUG/releases/$(
99+
jq -r '.id' <<< "$RELEASE"
100+
) \
101+
-d "$(
102+
jq -s '{
103+
"body": ((.[0] // "" | sub("(?<=\n)#+ Changes.*"; ""; "mi"))
104+
+ "### Changes\n\n" + .[1])
105+
}' <(jq '.body' <<< "$RELEASE") <(jq -sR '.' <<< "$CHANGES")
106+
)"
107+
fi

0 commit comments

Comments
 (0)