Skip to content

Commit 330c079

Browse files
committed
Document use of release scripts ahead of 4.4.4 release
These release scripts are from geonetwork#7399 Thanks @fxprunayre for this improvement.
1 parent 98cda16 commit 330c079

8 files changed

+450
-15
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ out/
3737
package-lock.json
3838
rebel.xml
3939
release/jetty/*
40-
release-build.sh
4140
schemas/*/doc/*/*.rst
4241
schematrons/.build
4342
target/
43+
44+
# build and release
4445
transifex/transifex-format/
46+
build/
47+
web-ui/LICENSE
48+
web-ui/tx
4549

4650
# web-app, clear using: mvn -f web/pom.xml clean:clean@reset
4751

docs/manual/docs/contributing/doing-a-release.md

+131-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,134 @@
11
# Doing a GeoNetwork release {#doing-a-release}
22

3+
## Doing a release with scripts
4+
5+
### Update Translations
6+
7+
1. Update translations:
8+
9+
```bash
10+
cd web-ui
11+
./download-from-transifex.sh
12+
```
13+
14+
Commit the changed files:
15+
16+
```bash
17+
git add .
18+
git commit -m "Transifix update"
19+
```
20+
21+
### Release Notes
22+
23+
1. Prepare change-log notes.
24+
25+
Git notes are managed in `ref/notes/commits` similar to push and pulling tags. Start by pulling the latest notes:
26+
```
27+
git fetch origin refs/notes/commits:refs/notes/commits
28+
```
29+
30+
Review changes along with any notes:
31+
```
32+
git log --pretty='format:%h: %s %n note: %N' $previousversion...
33+
```
34+
35+
Use `git note append` to document commits adding major features.
36+
37+
```
38+
git notes append <sha> -m "<description of major feature>"
39+
```
40+
41+
Use `git note remove` if you need to clear a note and start again:
42+
```
43+
git notes remove <sha>
44+
```
45+
46+
Preview changes using:
47+
48+
```
49+
git log --pretty='format:* %N' $previousversion... | grep -v "^* $"
50+
```
51+
52+
Save your notes:
53+
```
54+
git push origin refs/notes/commits
55+
```
56+
57+
2. Generate release notes:
58+
59+
```bash
60+
./release-notes
61+
```
62+
63+
After the script runs it will produces:
64+
65+
* ``docs/changes/changes4.4.4-0.txt``
66+
67+
The last couple commits here can be removed (from the release steps above).
68+
69+
* ``docs/manual/docs/overview/change-log/version-4.4.4.md``
70+
71+
This file can be updated based on highlights from: [milestone closed issues](https://github.com/geonetwork/core-geonetwork/pulls?q=is%3Apr+milestone%3A4.4.4+is%3Aclosed)
72+
73+
Filter using:
74+
75+
* label: `changelog` as Major Features
76+
* label: api change
77+
* label: `index structure change` as Index
78+
* label: `bug` as Fixes
79+
80+
3. Update the navigation:
81+
82+
* ``docs/manual/mkdocs.yml``
83+
* ``docs/manual/docs/overview/change-log/latest/index.md``
84+
85+
### Build the release locally
86+
87+
1. Use release build script:
88+
89+
```bash
90+
./release-build.sh
91+
```
92+
93+
2. Startup Elasticsearch
94+
95+
3. Remove local database:
96+
97+
```bash
98+
rm ~/gn.mv.db
99+
rm ~/gn.trace.db
100+
```
101+
102+
4. Test the release:
103+
104+
```bash
105+
./release-test.sh
106+
```
107+
108+
5. Smoke Test:
109+
110+
* Load ISO19139 samples and templates
111+
* Display a record and try each of the views, and the XML download
112+
* Use Contributor board to create a new record (from the "preferred" template)
113+
* Try validation (validation errors are expected we just wish to check it runs)
114+
* Try each of the editor views
115+
116+
### Publish the release
117+
118+
1. Publish
119+
120+
```bash
121+
./release-publish.sh
122+
```
123+
124+
2. Cleanup
125+
126+
```bash
127+
./release-restore.sh
128+
```
129+
130+
## Doing a manual release
131+
3132
This section documents the steps followed by the development team to do a new release.
4133

5134
Once the release branch has been thoroughly tested and is stable a release can be made.
@@ -56,9 +185,9 @@ with the following utilities: ***sed***, ***xmlstarlet*** and ***sftp***.
56185
57186
2. Prepare change-log notes.
58187
59-
Git notes are managed similar to push and pulling tags. Start by pulling the latest notes:
188+
Git notes are managed in `ref/notes/commits` similar to push and pulling tags. Start by pulling the latest notes:
60189
```
61-
git pull origin refs/notes/commits
190+
git fetch origin refs/notes/commits:refs/notes/commits
62191
```
63192
64193
Review changes along with any notes:

release-build.sh

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
buildRequiredApps=( "java" "git" "mvn" "ant" "xmlstarlet" )
4+
5+
for app in "${buildRequiredApps[@]}"; do :
6+
if ! [ -x "$(command -v ${app})" ]; then
7+
echo "Error: ${app} is not installed." >&2
8+
exit 1
9+
fi
10+
done
11+
12+
function showUsage
13+
{
14+
echo -e "\nThis script is used to build a release for the current branch"
15+
echo
16+
}
17+
18+
if [ "$1" = "-h" ]
19+
then
20+
showUsage
21+
exit
22+
fi
23+
24+
projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml`
25+
subVersion=`cut -d "-" -f 2 <<< $projectVersion`
26+
mainVersion=`cut -d "-" -f 1 <<< $projectVersion`
27+
mainVersionMajor=`cut -d "." -f 1 <<< $mainVersion`
28+
mainVersionMinor=`cut -d "." -f 2 <<< $mainVersion`
29+
mainVersionSub=`cut -d "." -f 3 <<< $mainVersion`
30+
31+
gitBranch=`git branch --show-current`
32+
33+
nextVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub+1))"
34+
previousVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub-1))"
35+
36+
from=origin
37+
frombranch=origin/${gitBranch}
38+
series=${mainVersionMajor}.${mainVersionMinor}
39+
versionbranch=${gitBranch}
40+
version=${projectVersion}
41+
minorversion=0
42+
release=latest
43+
newversion=${mainVersion}-$minorversion
44+
currentversion=${projectVersion}
45+
previousversion=${previousVersionNumber}
46+
nextversion=${nextVersionNumber}-SNAPSHOT
47+
48+
echo "Buuilding release for version ${newversion} (from ${currentversion})."
49+
echo ""
50+
echo "Before you start:"
51+
echo "1. Use web-ui/download-from-transifex.sh to update translations"
52+
echo "2. Use release-notes.sh to update change log and release notes"
53+
echo ""
54+
echo "After being build you can test the release before publishing. Git branch ${gitBranch}."
55+
read -p "Press enter to continue"
56+
57+
# Update version number (in pom.xml, installer config and SQL)
58+
./update-version.sh $currentversion $newversion
59+
60+
# Then commit the new version
61+
git add .
62+
git commit -m "Update version to $newversion"
63+
git tag -a $version -m "Tag for $version release"
64+
65+
# Build the new release
66+
mvn clean install -DskipTests -ntp -Pwar -Pwro4j-prebuild-cache
67+
68+
(cd datastorages && mvn clean install -DskipTests -ntp -Drelease -DskipTests)
69+
70+
# Download Jetty and create the installer
71+
(cd release && mvn clean install -Pjetty-download && ant)
72+
73+
# generate checksum for download artifacts
74+
75+
if [ -f "release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5" ]; then
76+
rm release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5
77+
fi
78+
79+
if [[ ${OSTYPE:0:6} == 'darwin' ]]; then
80+
md5 -r web/target/geonetwork.war > web/target/geonetwork.war.md5
81+
md5 -r release/target/GeoNetwork-$newversion/geonetwork-bundle-$newversion.zip > release/target/GeoNetwork-$newversion/geonetwork-bundle-$newversion.zip.md5
82+
else
83+
(cd web/target && md5sum geonetwork.war > geonetwork.war.md5)
84+
(cd release/target/GeoNetwork-$version && md5sum geonetwork-bundle-$newversion.zip > geonetwork-bundle-$newversion.zip.md5)
85+
fi

release-notes.sh

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
3+
buildRequiredApps=( "java" "git" "mvn" "ant" "xmlstarlet" )
4+
5+
for app in "${buildRequiredApps[@]}"; do :
6+
if ! [ -x "$(command -v ${app})" ]; then
7+
echo "Error: ${app} is not installed." >&2
8+
exit 1
9+
fi
10+
done
11+
12+
function showUsage
13+
{
14+
echo -e "\nThis script is used to build a release for the current branch"
15+
echo
16+
}
17+
18+
if [ "$1" = "-h" ]
19+
then
20+
showUsage
21+
exit
22+
fi
23+
24+
projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml`
25+
subVersion=`cut -d "-" -f 2 <<< $projectVersion`
26+
mainVersion=`cut -d "-" -f 1 <<< $projectVersion`
27+
mainVersionMajor=`cut -d "." -f 1 <<< $mainVersion`
28+
mainVersionMinor=`cut -d "." -f 2 <<< $mainVersion`
29+
mainVersionSub=`cut -d "." -f 3 <<< $mainVersion`
30+
31+
gitBranch=`git branch --show-current`
32+
33+
nextVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub+1))"
34+
previousVersionNumber="${mainVersionMajor}.${mainVersionMinor}.$((mainVersionSub-1))"
35+
36+
from=origin
37+
frombranch=origin/${gitBranch}
38+
series=${mainVersionMajor}.${mainVersionMinor}
39+
versionbranch=${gitBranch}
40+
version=${projectVersion}
41+
minorversion=0
42+
release=latest
43+
newversion=${mainVersion}-$minorversion
44+
currentversion=${projectVersion}
45+
previousversion=${previousVersionNumber}
46+
nextversion=${nextVersionNumber}-SNAPSHOT
47+
48+
echo "Creating change log and release notes for version ${newversion} (from ${currentversion}). Git branch ${gitBranch}:"
49+
echo " docs/changes/changes$newversion.txt"
50+
echo " docs/manual/docs/overview/change-log/version-$mainVersion.md"
51+
echo "When generated please review and update:"
52+
echo " docs/manual/mkdocs.yml"
53+
echo " docs/manual/docs/overview/latest/index.md"
54+
echo " docs/manual/docs/overview/change-log/version-$mainVersion.md"
55+
echo ""
56+
read -p "Press enter to continue"
57+
58+
# Generate list of changes
59+
cat <<EOF > docs/changes/changes$newversion.txt
60+
================================================================================
61+
===
62+
=== GeoNetwork $version: List of changes
63+
===
64+
================================================================================
65+
EOF
66+
git log --pretty='format:- %s' $previousversion... >> docs/changes/changes$newversion.txt
67+
68+
# Generate release notes
69+
70+
cat <<EOF > docs/manual/docs/overview/change-log/version-$mainVersion.md
71+
# Version $mainVersion
72+
73+
GeoNetwork $mainVersion is a minor release.
74+
75+
## Migration notes
76+
77+
### API changes
78+
79+
### Installation changes
80+
81+
### Index changes
82+
83+
## List of changes
84+
85+
Major changes:
86+
87+
EOF
88+
89+
git log --pretty='format:* %N' $previousversion.. | grep -v "^* $" >> docs/manual/docs/overview/change-log/version-$mainVersion.md
90+
91+
cat <<EOF >> docs/manual/docs/overview/change-log/version-$mainVersion.md
92+
93+
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.
94+
EOF

0 commit comments

Comments
 (0)