-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathupdate_changes.sh
55 lines (44 loc) · 1.56 KB
/
update_changes.sh
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
#!/bin/bash
#
# Adapted from https://github.com/nipy/nipype/blob/master/tools/update_changes.sh
#
# This is a script to be run before releasing a new version.
#
# Usage /bin/bash update_changes.sh 0.5.1
#
# Setting # $ help set
set -u # Treat unset variables as an error when substituting.
set -x # Print command traces before executing command.
CHANGES=../CHANGELOG.md
# Add changelog documentation
cat > newchanges <<'_EOF'
# Changelog
All notable changes to this project will be documented (for humans) in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
_EOF
# List all merged PRs
curl -s https://api.github.com/repos/nipy/heudiconv/pulls?state=closed+milestone=$1 | jq -r \
'.[] | "\(.title) #\(.number) milestone:\(.milestone.title) \(.merged_at)"' | sed '/null/d' | sed '/milestone:0.5 /d' >> newchanges
echo "" >> newchanges
echo "" >> newchanges
# Elaborate today's release header
HEADER="## [$1] - $(date '+%Y-%m-%d')"
echo $HEADER >> newchanges
echo "TODO Summary" >> newchanges
echo "### Added" >> newchanges
echo "" >> newchanges
echo "### Changed" >> newchanges
echo "" >> newchanges
echo "### Deprecated" >> newchanges
echo "" >> newchanges
echo "### Fixed" >> newchanges
echo "" >> newchanges
echo "### Removed" >> newchanges
echo "" >> newchanges
echo "### Security" >> newchanges
echo "" >> newchanges
# Append old CHANGES
tail -n+7 $CHANGES >> newchanges
# Replace old CHANGES with new file
mv newchanges $CHANGES