Skip to content

Commit 39b0712

Browse files
committed
automatically update CHANGES.rst with each PR - taken from fmriprep
1 parent 652fdf6 commit 39b0712

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

update_changes.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
#
3+
# Collects the pull-requests since the latest release and
4+
# aranges them in the CHANGES.rst.txt file.
5+
#
6+
# This is a script to be run before releasing a new version.
7+
# Authored by Oscar Esteban
8+
#
9+
# Usage /bin/bash update_changes.sh 1.0.1
10+
#
11+
# Copyright (c) 2015-2018, the CRN developers team.
12+
# All rights reserved.
13+
#
14+
# Redistribution and use in source and binary forms, with or without
15+
# modification, are permitted provided that the following conditions are met:
16+
#
17+
# * Redistributions of source code must retain the above copyright notice, this
18+
# list of conditions and the following disclaimer.
19+
#
20+
# * Redistributions in binary form must reproduce the above copyright notice,
21+
# this list of conditions and the following disclaimer in the documentation
22+
# and/or other materials provided with the distribution.
23+
#
24+
# * Neither the name of fmriprep nor the names of its
25+
# contributors may be used to endorse or promote products derived from
26+
# this software without specific prior written permission.
27+
#
28+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+
39+
40+
# Setting # $ help set
41+
# set -u # Treat unset variables as an error when substituting.
42+
set -x # Print command traces before executing command.
43+
44+
# Check whether the Upcoming release header is present
45+
head -1 CHANGES.rst | grep -q Upcoming
46+
UPCOMING=$?
47+
if [[ "$UPCOMING" == "0" ]]; then
48+
head -n3 CHANGES.rst >> newchanges
49+
fi
50+
51+
# Elaborate today's release header
52+
HEADER="$1 ($(date '+%B %d, %Y'))"
53+
echo $HEADER >> newchanges
54+
echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges
55+
echo "" >> newchanges
56+
57+
# Search for PRs since previous release
58+
git log --grep="Merge pull request" `git describe --tags --abbrev=0`..HEAD --pretty='format: * %b %s' | sed 's/Merge pull request \#\([^\d]*\)\ from\ .*/(\#\1)/' >> newchanges
59+
echo "" >> newchanges
60+
echo "" >> newchanges
61+
62+
# Add back the Upcoming header if it was present
63+
if [[ "$UPCOMING" == "0" ]]; then
64+
tail -n+4 CHANGES.rst >> newchanges
65+
else
66+
cat CHANGES.rst >> newchanges
67+
fi
68+
69+
# Replace old CHANGES.rst with new file
70+
mv newchanges CHANGES.rst

0 commit comments

Comments
 (0)