Skip to content

Commit

Permalink
Document use of release scripts ahead of 4.4.4 release
Browse files Browse the repository at this point in the history
These release scripts are from geonetwork#7399

Thanks @fxprunayre for this improvement.
  • Loading branch information
jodygarnett committed Apr 16, 2024
1 parent 98cda16 commit 330c079
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ out/
package-lock.json
rebel.xml
release/jetty/*
release-build.sh
schemas/*/doc/*/*.rst
schematrons/.build
target/

# build and release
transifex/transifex-format/
build/
web-ui/LICENSE
web-ui/tx

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

Expand Down
133 changes: 131 additions & 2 deletions docs/manual/docs/contributing/doing-a-release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,134 @@
# Doing a GeoNetwork release {#doing-a-release}

## Doing a release with scripts

### Update Translations

1. Update translations:

```bash
cd web-ui
./download-from-transifex.sh
```

Commit the changed files:

```bash
git add .
git commit -m "Transifix update"
```

### Release Notes

1. Prepare change-log notes.

Git notes are managed in `ref/notes/commits` similar to push and pulling tags. Start by pulling the latest notes:
```
git fetch origin refs/notes/commits:refs/notes/commits
```
Review changes along with any notes:
```
git log --pretty='format:%h: %s %n note: %N' $previousversion...
```
Use `git note append` to document commits adding major features.
```
git notes append <sha> -m "<description of major feature>"
```
Use `git note remove` if you need to clear a note and start again:
```
git notes remove <sha>
```
Preview changes using:
```
git log --pretty='format:* %N' $previousversion... | grep -v "^* $"
```
Save your notes:
```
git push origin refs/notes/commits
```
2. Generate release notes:
```bash
./release-notes
```

After the script runs it will produces:

* ``docs/changes/changes4.4.4-0.txt``

The last couple commits here can be removed (from the release steps above).

* ``docs/manual/docs/overview/change-log/version-4.4.4.md``

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)

Filter using:

* label: `changelog` as Major Features
* label: api change
* label: `index structure change` as Index
* label: `bug` as Fixes

3. Update the navigation:

* ``docs/manual/mkdocs.yml``
* ``docs/manual/docs/overview/change-log/latest/index.md``

### Build the release locally

1. Use release build script:

```bash
./release-build.sh
```

2. Startup Elasticsearch

3. Remove local database:

```bash
rm ~/gn.mv.db
rm ~/gn.trace.db
```

4. Test the release:

```bash
./release-test.sh
```

5. Smoke Test:

* Load ISO19139 samples and templates
* Display a record and try each of the views, and the XML download
* Use Contributor board to create a new record (from the "preferred" template)
* Try validation (validation errors are expected we just wish to check it runs)
* Try each of the editor views

### Publish the release

1. Publish

```bash
./release-publish.sh
```

2. Cleanup

```bash
./release-restore.sh
```

## Doing a manual release

This section documents the steps followed by the development team to do a new release.

Once the release branch has been thoroughly tested and is stable a release can be made.
Expand Down Expand Up @@ -56,9 +185,9 @@ with the following utilities: ***sed***, ***xmlstarlet*** and ***sftp***.
2. Prepare change-log notes.
Git notes are managed similar to push and pulling tags. Start by pulling the latest notes:
Git notes are managed in `ref/notes/commits` similar to push and pulling tags. Start by pulling the latest notes:
```
git pull origin refs/notes/commits
git fetch origin refs/notes/commits:refs/notes/commits
```
Review changes along with any notes:
Expand Down
85 changes: 85 additions & 0 deletions release-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/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 "Buuilding release for version ${newversion} (from ${currentversion})."
echo ""
echo "Before you start:"
echo "1. Use web-ui/download-from-transifex.sh to update translations"
echo "2. Use release-notes.sh to update change log and release notes"
echo ""
echo "After being build you can test the release before publishing. Git branch ${gitBranch}."
read -p "Press enter to continue"
# Update version number (in pom.xml, installer config and SQL)
./update-version.sh $currentversion $newversion
# Then commit the new version
git add .
git commit -m "Update version to $newversion"
git tag -a $version -m "Tag for $version release"
# Build the new release
mvn clean install -DskipTests -ntp -Pwar -Pwro4j-prebuild-cache
(cd datastorages && mvn clean install -DskipTests -ntp -Drelease -DskipTests)
# Download Jetty and create the installer
(cd release && mvn clean install -Pjetty-download && ant)
# generate checksum for download artifacts
if [ -f "release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5" ]; then
rm release/target/GeoNetwork-$version/geonetwork-bundle-$newversion.zip.MD5
fi
if [[ ${OSTYPE:0:6} == 'darwin' ]]; then
md5 -r web/target/geonetwork.war > web/target/geonetwork.war.md5
md5 -r release/target/GeoNetwork-$newversion/geonetwork-bundle-$newversion.zip > release/target/GeoNetwork-$newversion/geonetwork-bundle-$newversion.zip.md5
else
(cd web/target && md5sum geonetwork.war > geonetwork.war.md5)
(cd release/target/GeoNetwork-$version && md5sum geonetwork-bundle-$newversion.zip > geonetwork-bundle-$newversion.zip.md5)
fi
94 changes: 94 additions & 0 deletions release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
Loading

0 comments on commit 330c079

Please sign in to comment.