Skip to content

Commit 2738689

Browse files
authored
Merge pull request #2440 from oesteban/enh/changelog-update-script
ENH: Automate updates of CHANGES
2 parents 6e07273 + 6d5e40f commit 2738689

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

CHANGES

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
Upcoming release
2-
================
3-
41
1.0.0 (January 24, 2018)
52
========================
63

tools/update_changes.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
#
3+
# Collects the pull-requests since the latest release and
4+
# aranges them in the CHANGES.txt file.
5+
#
6+
# This is a script to be run before releasing a new version.
7+
#
8+
# Usage /bin/bash update_changes.sh 1.0.1
9+
#
10+
11+
# Setting # $ help set
12+
set -u # Treat unset variables as an error when substituting.
13+
set -x # Print command traces before executing command.
14+
15+
# Check whether the Upcoming release header is present
16+
head -1 CHANGES | grep -q Upcoming
17+
UPCOMING=$?
18+
19+
# Elaborate today's release header
20+
HEADER="$1 ($(date '+%B %d, %Y'))"
21+
echo $HEADER >> newchanges
22+
echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges
23+
echo "" >> newchanges
24+
25+
# Search for PRs since previous release
26+
git log --grep="Merge pull request" `git describe --tags --abbrev=0`..HEAD --pretty='format: * %b %s' | sed 's+Merge pull request \#\([^\d]*\)\ from\ .*+(https://github.com/nipy/nipype/pull/\1)+' >> newchanges
27+
echo "" >> newchanges
28+
echo "" >> newchanges
29+
30+
# Append old CHANGES
31+
if [[ "$UPCOMING" == "0" ]]; then
32+
# Drop the Upcoming title if present
33+
tail -n+4 CHANGES >> newchanges
34+
else
35+
cat CHANGES >> newchanges
36+
fi
37+
38+
# Replace old CHANGES with new file
39+
mv newchanges CHANGES
40+

0 commit comments

Comments
 (0)