发布GeoNetwork

本节记录了开发团队执行新版本所遵循的步骤。

一旦释放分支经过彻底测试并且稳定,就可以进行释放。

  1. 建立发行版

# Setup properties
frombranch=origin/master
versionbranch=3.12.x
version=3.12.1
minorversion=0
newversion=$version-$minorversion
currentversion=3.12-SNAPSHOT
previousversion=3.12.0
nextversion=3.12-SNAPSHOT
nextMajorVersion=4.0.0-SNAPSHOT


# Get the branch
git clone --recursive https://github.com/geonetwork/core-geonetwork.git \
          geonetwork-$versionbranch
cd geonetwork-$versionbranch


# Create or move to the branch for the version
# Create it if it does not exist yet
git checkout -b $versionbranch $frombranch
# or move into it if it exist
# git checkout $versionbranch


# Update version number (in pom.xml, installer config and SQL)
./update-version.sh $currentversion $newversion


# Build the new release
mvn clean install -DskipTests -Pwith-doc


# Generate list of changes
cat <<EOF > docs/changes$newversion.txt
================================================================================
===
=== GeoNetwork $version: List of changes
===
================================================================================
EOF
git log --pretty='format:- %s' $previousversion... >> docs/changes$newversion.txt


# Download Jetty and create the installer
cd release
mvn process-resources -Djetty-download
mvn package

# Deploy to osgeo repository (requires credentials in ~/.m2/settings.xml)
mvn deploy
  1. 测试安装程序

cd target/GeoNetwork-$newversion
unzip geonetwork-bundle-$newversion.zip -d geonetwork-bundle-$newversion
cd geonetwork-bundle-$newversion/bin
./startup.sh
  1. 提交并标记新版本

# Then commit the new version
git add .
git commit -m "Update version to $newversion"

# Push the release tag
git tag -a $version -m "Tag for $version release"
git push origin $version

# Set version number to SNAPSHOT
./update-version.sh $newversion $nextversion

# Add SQL migration step for the next version
mkdir web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v3122
cat <<EOF > web/src/main/webapp/WEB-INF/classes/setup/sql/migrate/v3122/migrate-default.sql
UPDATE Settings SET value='3.12.2' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';
EOF
vi web/src/main/webResources/WEB-INF/config-db/database_migration.xml

WEB-INF/config-db/database_migration.xml 在以下两个步骤中为新版本添加条目:

<entry key="3.12.2">
  <list>
    <value>WEB-INF/classes/setup/sql/migrate/v3122/migrate-</value>
  </list>
</entry>
git add .
git commit -m "Update version to $nextversion"


# Push the branch
git push origin $versionbranch
  1. 发布

生成校验和文件

  • 如果使用Linux:

cd web/target && md5sum geonetwork.war > geonetwork.war.md5 && cd ../..
cd release/target/GeoNetwork-$version && md5sum geonetwork-bundle-$newversion.zip >  geonetwork-bundle-$newversion.zip.md5 && cd ../..
  • 如果使用Mac OS X:

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

在sourceforge上首先:

sftp $sourceforge_username,geonetwork@frs.sourceforge.net
# For stable release
cd /home/frs/project/g/ge/geonetwork/GeoNetwork_opensource
# or for RC release
cd /home/frs/project/g/ge/geonetwork/GeoNetwork_unstable_development_versions/
mkdir v3.12.1
cd v3.12.1
put docs/changes3.12.1-0.txt
put release/target/GeoNetwork*/geonetwork-bundle*.zip*
put web/target/geonetwork.war*
bye

在Documentation https://github.com/geonetwork/doc中更新或添加更改日志。

关闭github上的里程碑https://github.com/geonetwork/core-geonetwork/milemones?state=已关闭,并链接到sourceforge下载。

在giHub https://github.com/geonetwork/core-geonetwork/releases上发布该版本。

更新网站链接https://github.com/geonetwork/website。

向邮件列表发送电子邮件。

  1. 合并依赖分支

如果是主版本,则主版本必须更新到下一个版本(例如,如果是3.8.0,则3.7.x是3.9.x)。

# Create it if it does not exist yet
git checkout master
./update-version.sh $currentversion $nextMajorVersion

在下列文件夹中 web/src/main/webapp/WEB-INF/classes/setup/sql/migrate 创造 v370 文件夹。

在此文件夹中创建 migrate-default.sql with the following content:

UPDATE Settings SET value='3.7.0' WHERE name='system/platform/version';
UPDATE Settings SET value='SNAPSHOT' WHERE name='system/platform/subVersion';

web/src/main/webResources/WEB-INF/config-db/database_migration.xml 为迁移添加以下内容以调用迁移脚本:

<entry key="3.7.0">
  <list>
    <value>WEB-INF/classes/setup/sql/migrate/v370/migrate-</value>
  </list>
</entry>

提交新版本

git add .
git commit -m "Update version to $nextMajorVersion"
git push origin master