From 5483385f4a752134309906a627eb361437f276ed Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 10 Dec 2018 17:46:05 +0100 Subject: [PATCH] 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. --- build.gradle | 1 - .../spring-doc-resources-ci-image/Dockerfile | 2 +- ci/scripts/promote.sh | 0 ci/scripts/stage.sh | 20 ++++++++++++------- ci/tasks/stage.yml | 2 ++ gradle.properties | 1 + 6 files changed, 17 insertions(+), 9 deletions(-) mode change 100644 => 100755 ci/scripts/promote.sh create mode 100644 gradle.properties diff --git a/build.gradle b/build.gradle index 7a16b48..751bc8c 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ plugins { group = 'io.spring.docresources' description = 'Spring Documentation Resources' -version = "0.1.0.BUILD-SNAPSHOT" node { version = '11.2.0' diff --git a/ci/images/spring-doc-resources-ci-image/Dockerfile b/ci/images/spring-doc-resources-ci-image/Dockerfile index 70de25e..4c18696 100644 --- a/ci/images/spring-doc-resources-ci-image/Dockerfile +++ b/ci/images/spring-doc-resources-ci-image/Dockerfile @@ -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 diff --git a/ci/scripts/promote.sh b/ci/scripts/promote.sh old mode 100644 new mode 100755 diff --git a/ci/scripts/stage.sh b/ci/scripts/stage.sh index 16c9a4f..0c9ffc1 100755 --- a/ci/scripts/stage.sh +++ b/ci/scripts/stage.sh @@ -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" diff --git a/ci/tasks/stage.yml b/ci/tasks/stage.yml index 1cbcc1f..191af62 100644 --- a/ci/tasks/stage.yml +++ b/ci/tasks/stage.yml @@ -8,5 +8,7 @@ outputs: caches: - path: maven - path: gradle +params: + RELEASE_TYPE: run: path: git-repo/ci/scripts/stage.sh diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3343404 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +version=0.1.0.BUILD-SNAPSHOT \ No newline at end of file