Merge pull request #18 from weskamm/releasescript

Adding build and release script
pull/19/head
Nils Bühner 2023-02-01 13:33:45 +01:00 committed by GitHub
commit a617492f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 0 deletions

1
.dockerignore 100644
View File

@ -0,0 +1 @@
build/

View File

@ -225,3 +225,19 @@ Push to osgeo repository:
```shell ```shell
docker push geoserver-docker.osgeo.org/geoserver:2.21.1 docker push geoserver-docker.osgeo.org/geoserver:2.21.1
``` ```
### How to automate release?
For CI purposes, the script in the `build` folder is used to simplify those steps.
The variables `DOCKERUSER` and `DOCKERPASSWORD` have to be set with valid credentials before this script can push the image to the osgeo repo.
You need to pass the version as first and the type as second argument, where type has to be one of `build`, `publish` or `buildandpublish`.
Examples:
`./release.sh 2.22.1 build`
`./release.sh 2.22.0 publish`
`./release.sh 2.22.1 buildandpublish`

34
build/release.sh 100755
View File

@ -0,0 +1,34 @@
#!/bin/bash
# error out if any statements fail
set -e
function usage() {
echo "$0 [options] <version>"
echo " version : The released version to build an docker image for (eg: 2.1.4)"
echo " mode : The mode. Choose one of 'build', 'publish' or 'buildandpublish'"
}
if [ -z $1 ] || [ -z $2 ] || [[ $2 != "build" && $2 != "publish" && $2 != "buildandpublish" ]]; then
usage
exit
fi
VERSION=$1
TAG=geoserver-docker.osgeo.org/geoserver:$VERSION
# Go up one level to the Dockerfile
cd ".."
if [ $2 != "publish" ]; then
echo "Building GeoServer Docker Image..."
echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ."
docker build --build-arg GS_VERSION=$VERSION -t $TAG .
fi
if [ $2 != "build" ]; then
echo "Publishing GeoServer Docker Image..."
echo $DOCKERPASSWORD | docker login -u $DOCKERUSER --password-stdin geoserver-docker.osgeo.org
echo "docker push $TAG"
docker push $TAG
fi