Skip to content

Commit 0bb1f7a

Browse files
committed
Modified release script to create notes only on minor releases
Before, release notes with a list of changes were created every patch release. Unfortunately, it looks like this will create a lot of noise on github, with a notification every patch release, which may be as often as every time a PR is merged. Rather than creating all of this noise for relatively uninteresting changes, the script will now stick to simple tags, and create the release notes only on minor releases. I think this is what several of you were originally suggesting, sorry about the journey, at least I learned a lot.
1 parent 447d89c commit 0bb1f7a

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

.travis.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,13 @@ jobs:
140140
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
141141
# Grab latests patch from repo tags, default to 0, needs finagling to get past github's pagination api
142142
- PREV_URL=https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.
143-
- PREV_URL=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I
143+
- PREV_URL=$(curl -u "$GEKY_BOT_RELEASES" "$PREV_URL" -I
144144
| sed -n '/^Link/{s/.*<\(.*\)>; rel="last"/\1/;p;q0};$q1'
145145
|| echo $PREV_URL)
146-
- LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES" "$PREV_URL"
146+
- LFS_VERSION_PATCH=$(curl -u "$GEKY_BOT_RELEASES" "$PREV_URL"
147147
| jq 'map(.ref | match("\\bv.*\\..*\\.(.*)$";"g")
148-
.captures[].string | tonumber + 1) | max // 0')
148+
.captures[].string | tonumber) | max + 1'
149+
|| echo 0)
149150
# We have our new version
150151
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH"
151152
- echo "VERSION $LFS_VERSION"
@@ -156,24 +157,34 @@ jobs:
156157
| jq -re '.sha')
157158
if [ "$TRAVIS_COMMIT" == "$CURRENT_COMMIT" ]
158159
then
159-
# Build release notes
160-
PREV=$(git tag --sort=-v:refname -l "v*" | head -1)
161-
if [ ! -z "$PREV" ]
162-
then
163-
echo "PREV $PREV"
164-
CHANGES=$'### Changes\n\n'$( \
165-
git log --oneline $PREV.. --grep='^Merge' --invert-grep)
166-
printf "CHANGES\n%s\n\n" "$CHANGES"
167-
fi
168-
# Create the release
160+
# Create a simple tag
169161
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
170-
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
162+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
171163
-d "{
172-
\"tag_name\": \"$LFS_VERSION\",
173-
\"target_commitish\": \"$TRAVIS_COMMIT\",
174-
\"name\": \"${LFS_VERSION%.0}\",
175-
\"body\": $(jq -sR '.' <<< "$CHANGES")
164+
\"ref\": \"refs/tags/$LFS_VERSION\",
165+
\"sha\": \"$TRAVIS_COMMIT\"
176166
}"
167+
# Minor release?
168+
if [[ "$LFS_VERSION" == *.0 ]]
169+
then
170+
# Build release notes
171+
PREV=$(git tag --sort=-v:refname -l "v*.0" | head -1)
172+
if [ ! -z "$PREV" ]
173+
then
174+
echo "PREV $PREV"
175+
CHANGES=$'### Changes\n\n'$( \
176+
git log --oneline $PREV.. --grep='^Merge' --invert-grep)
177+
printf "CHANGES\n%s\n\n" "$CHANGES"
178+
fi
179+
# Create the release
180+
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
181+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
182+
-d "{
183+
\"tag_name\": \"$LFS_VERSION\",
184+
\"name\": \"${LFS_VERSION%.0}\",
185+
\"body\": $(jq -sR '.' <<< "$CHANGES")
186+
}"
187+
fi
177188
fi
178189
179190
# Manage statuses

0 commit comments

Comments
 (0)