Fix Stage and Promote release process

This commit contains a few fixes for the CI release process.

The base CI image now installs the `jq` binary as it's
required by the promotion process.

The staging script is fixed to use the correct `sed` syntax
for this Linux container, and only consider Gradle as a build
system. This also changes the staging script to correctly
choose the release version depending on the release type.
This commit also adds a `RELEASE_TYPE` parameter to the state
task.

The project build version is moved to a `gradle.properties`
to align with the stage+promote script.

The promote release script is now executable.
This commit is contained in:
Brian Clozel 2018-12-10 17:46:05 +01:00
parent 5ea673a0d5
commit 5483385f4a
6 changed files with 17 additions and 9 deletions

View File

@ -7,7 +7,6 @@ plugins {
group = 'io.spring.docresources'
description = 'Spring Documentation Resources'
version = "0.1.0.BUILD-SNAPSHOT"
node {
version = '11.2.0'

View File

@ -1,7 +1,7 @@
FROM ubuntu:bionic-20181018
RUN apt-get update
RUN apt-get install --no-install-recommends -y ca-certificates net-tools git curl
RUN apt-get install --no-install-recommends -y ca-certificates net-tools git curl jq
RUN rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME /opt/openjdk

0
ci/scripts/promote.sh Normal file → Executable file
View File

View File

@ -13,28 +13,34 @@ git clone git-repo stage-git-repo > /dev/null
pushd stage-git-repo > /dev/null
snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
stageVersion=$( strip_snapshot_suffix $snapshotVersion)
if [[ $RELEASE_TYPE = "M" ]]; then
stageVersion=$( get_next_milestone_release $snapshotVersion)
nextVersion=$snapshotVersion
elif [[ $RELEASE_TYPE = "RC" ]]; then
stageVersion=$( get_next_rc_release $snapshotVersion)
nextVersion=$snapshotVersion
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
stageVersion=$( get_next_release $snapshotVersion)
nextVersion=$( bump_version_number $snapshotVersion)
else
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
fi
echo "Staging $stageVersion (next version will be $nextVersion)"
sed -i "" "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
git config user.name "Spring Buildmaster" > /dev/null
git config user.email "buildmaster@springframework.org" > /dev/null
git add pom.xml > /dev/null
git add gradle.properties > /dev/null
git commit -m"Release v$stageVersion" > /dev/null
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
./gradlew --no-daemon clean build install -Dmaven.repo.local=${repository}
./gradlew --no-daemon clean distZip publishToMavenLocal -Dmaven.repo.local=${repository}
git reset --hard HEAD^ > /dev/null
echo "Setting next development version (v$nextVersion)"
sed -i "" "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
git add . > /dev/null
sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
git add gradle.properties > /dev/null
git commit -m"Next development version (v$nextVersion)" > /dev/null
echo "DONE"

View File

@ -8,5 +8,7 @@ outputs:
caches:
- path: maven
- path: gradle
params:
RELEASE_TYPE:
run:
path: git-repo/ci/scripts/stage.sh

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
version=0.1.0.BUILD-SNAPSHOT