forked from geonetwork/core-geonetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-notes.sh
executable file
·94 lines (71 loc) · 2.84 KB
/
release-notes.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
buildRequiredApps=( "java" "git" "mvn" "ant" "xmlstarlet" )
for app in "${buildRequiredApps[@]}"; do :
if ! [ -x "$(command -v ${app})" ]; then
echo "Error: ${app} is not installed." >&2
exit 1
fi
done
function showUsage
{
echo -e "\nThis script is used to build a release for the current branch"
echo
}
if [ "$1" = "-h" ]
then
showUsage
exit
fi
projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml`
subVersion=`cut -d "-" -f 2 <<< $projectVersion`
mainVersion=`cut -d "-" -f 1 <<< $projectVersion`
mainVersionMajor=`cut -d "." -f 1 <<< $mainVersion`
mainVersionMinor=`cut -d "." -f 2 <<< $mainVersion`
mainVersionSub=`cut -d "." -f 3 <<< $mainVersion`
gitBranch=`git branch --show-current`
nextVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub+1))"
previousVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub-1))"
from=origin
frombranch=origin/${gitBranch}
series=${mainVersionMajor}.${mainVersionMinor}
versionbranch=${gitBranch}
version=${projectVersion}
minorversion=0
release=latest
newversion=${mainVersion}-$minorversion
currentversion=${projectVersion}
previousversion=${previousVersionNumber}
nextversion=${nextVersionNumber}-SNAPSHOT
echo "Creating change log and release notes for version ${newversion} (from ${currentversion}). Git branch ${gitBranch}:"
echo " docs/changes/changes$newversion.txt"
echo " docs/manual/docs/overview/change-log/version-$mainVersion.md"
echo "When generated please review and update:"
echo " docs/manual/mkdocs.yml"
echo " docs/manual/docs/overview/latest/index.md"
echo " docs/manual/docs/overview/change-log/version-$mainVersion.md"
echo ""
read -p "Press enter to continue"
# Generate list of changes
cat <<EOF > docs/changes/changes$newversion.txt
================================================================================
===
=== GeoNetwork $version: List of changes
===
================================================================================
EOF
git log --pretty='format:- %s' $previousversion... >> docs/changes/changes$newversion.txt
# Generate release notes
cat <<EOF > docs/manual/docs/overview/change-log/version-$mainVersion.md
# Version $mainVersion
GeoNetwork $mainVersion is a minor release.
## Migration notes
### API changes
### Installation changes
### Index changes
## List of changes
Major changes:
EOF
git log --pretty='format:* %N' $previousversion.. | grep -v "^* $" >> docs/manual/docs/overview/change-log/version-$mainVersion.md
cat <<EOF >> docs/manual/docs/overview/change-log/version-$mainVersion.md
and more \... see [$newversion issues](https://github.com/geonetwork/core-geonetwork/issues?q=is%3Aissue+milestone%3A$mainVersion+is%3Aclosed) and [pull requests](https://github.com/geonetwork/core-geonetwork/pulls?page=3&q=is%3Apr+milestone%3A$mainVersion+is%3Aclosed) for full details.
EOF