From 330c0793cb656ab1e2e6b7444fbbce8f7dcbb6f1 Mon Sep 17 00:00:00 2001 From: Jody Garnett Date: Tue, 16 Apr 2024 12:49:39 +0200 Subject: [PATCH] Document use of release scripts ahead of 4.4.4 release These release scripts are from https://github.com/geonetwork/core-geonetwork/pull/7399 Thanks @fxprunayre for this improvement. --- .gitignore | 6 +- .../docs/contributing/doing-a-release.md | 133 +++++++++++++++++- release-build.sh | 85 +++++++++++ release-notes.sh | 94 +++++++++++++ release-publish.sh | 55 ++++++++ release-restore.sh | 42 ++++++ release-test.sh | 12 ++ web-ui/README.md | 38 +++-- 8 files changed, 450 insertions(+), 15 deletions(-) create mode 100755 release-build.sh create mode 100755 release-notes.sh create mode 100755 release-publish.sh create mode 100644 release-restore.sh create mode 100755 release-test.sh diff --git a/.gitignore b/.gitignore index 36df50f9368..cbd4fe33eaa 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/docs/manual/docs/contributing/doing-a-release.md b/docs/manual/docs/contributing/doing-a-release.md index c69cddb6178..254ef9386c1 100644 --- a/docs/manual/docs/contributing/doing-a-release.md +++ b/docs/manual/docs/contributing/doing-a-release.md @@ -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 -m "" + ``` + + Use `git note remove` if you need to clear a note and start again: + ``` + git notes remove + ``` + + 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. @@ -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: diff --git a/release-build.sh b/release-build.sh new file mode 100755 index 00000000000..8f84c41974b --- /dev/null +++ b/release-build.sh @@ -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 diff --git a/release-notes.sh b/release-notes.sh new file mode 100755 index 00000000000..0c4e40c3d00 --- /dev/null +++ b/release-notes.sh @@ -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 < 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 < 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 <> 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 diff --git a/release-publish.sh b/release-publish.sh new file mode 100755 index 00000000000..6da58990c27 --- /dev/null +++ b/release-publish.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +function showUsage +{ + echo -e "\nThis script is used to publish a release on sourceforge, github and maven repository" + echo + echo -e "Usage: ./`basename $0` sourceforge_username [remote]" + echo + echo -e "Example:" + echo -e "\t./`basename $0` sourceforgeusername" + echo -e "\t./`basename $0` sourceforgeusername upstream" + echo +} + +if [ "$1" = "-h" ] +then + showUsage + exit +fi + +if [[ ($# -ne 1) && ($# -ne 2) ]] +then + showUsage + exit +fi + +projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml` +version=`cut -d "-" -f 1 <<< $projectVersion` +versionbranch=`git branch --show-current` +sourceforge_username=$1 +remote=origin + +if [ $# -eq 2 ] +then + remote=$2 +fi + +# Push the branch and tag to github +git push $remote $versionbranch +git push $remote $version +# TODO: attach release notes to version + +sftp $sourceforge_username,geonetwork@frs.sourceforge.net << EOT +cd /home/frs/project/g/ge/geonetwork/GeoNetwork_opensource +mkdir v${version} +cd v${version} +put docs/changes/changes{$version}-0.txt +put release/target/GeoNetwork*/geonetwork-bundle*.zip* +put web/target/geonetwork.war* +put datastorages/*/target/*.zip +bye +EOT + +# Deploy to osgeo repository (requires credentials in ~/.m2/settings.xml) +mvn deploy -DskipTests -Drelease diff --git a/release-restore.sh b/release-restore.sh new file mode 100644 index 00000000000..4f166f4de51 --- /dev/null +++ b/release-restore.sh @@ -0,0 +1,42 @@ +#!/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 + +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 + +# Set version number to SNAPSHOT +./update-version.sh $newversion $nextversion + +git add . +git commit -m "Update version to $nextversion" + + diff --git a/release-test.sh b/release-test.sh new file mode 100755 index 00000000000..98e49da4b0b --- /dev/null +++ b/release-test.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +projectVersion=`xmlstarlet sel -t -m "/_:project/_:version" -v . -n pom.xml` +version=`cut -d "-" -f 1 <<< $projectVersion` +versionbranch=`git branch --show-current` + +echo "Testing zip in release/target/GeoNetwork-$version ..." + +cd "release/target/GeoNetwork-$version" +unzip -q "geonetwork-bundle-$projectVersion.zip" -d "geonetwork-bundle-$projectVersion" +cd "geonetwork-bundle-$projectVersion/bin" +./startup.sh -f diff --git a/web-ui/README.md b/web-ui/README.md index 5309e3b8f25..d0d0b59fdff 100644 --- a/web-ui/README.md +++ b/web-ui/README.md @@ -4,8 +4,6 @@ This module contains a web user interface for GeoNetwork opensource based on AngularJS, Bootstrap and d3.js librairies. - - ## Compile Wro4j is is used to compile and manage JS dependencies. @@ -17,17 +15,33 @@ Maven build is using Prettier to format JS and HTML code. ## Translate client app -Generate a transifex token API from https://www.transifex.com/user/settings/api/ +1. Generate a transifex token API from https://www.transifex.com/user/settings/api/ + + The token is to be saved in ``~/.transifexrc`` . + +2. Install transifex ``tx`` client from https://developers.transifex.com/docs/cli + + Recommend installing in ``~`` home folder: -Install transifex client: + ```bash + cd ~ + curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash + ``` + + You will need to restart your shell after ``tx`` client is added to path. -```shell script -curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash -``` +3. Download translations from transifex: -Download translations from transifex: + ```bash + cd web-ui + ./download-from-transifex.sh + ``` -```shell script -cd web-ui -./download-from-transifex.sh -``` +4. Commit the changed files: + + ```bash + git add . + git commit -m "Transifix update" + ``` + + And submit as a pull-request.