forked from spring-projects/spring-framework
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Release pipeline for Milestone versions
This commit finishes the first step for migrating our complete build and release pipeline to Concourse CI. We're creating here a new "Release" jobs group in our pipeline. We can now release Milestones from our pipeline with: * the "stage-milestone" job, which creates and tags a new Milestone version on the source repository, builds the artifacts and deploys them in a staging repository and updates the version to the next SNAPSHOT. * the "promote-milestone" fetches the build information from the staging repository and promotes the released milestone in the official milestone repository. Interactions with the Artifactory and Bintray REST APIs are done using the https://github.com/spring-io/concourse-release-scripts project. Closes spring-projectsgh-22490
- Loading branch information
Showing
6 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source $(dirname $0)/common.sh | ||
|
||
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) | ||
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json | ||
|
||
java -jar /opt/concourse-release-scripts.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION > /dev/null || { exit 1; } | ||
|
||
java -jar /opt/concourse-release-scripts.jar distribute $RELEASE_TYPE $BUILD_INFO_LOCATION > /dev/null || { exit 1; } | ||
|
||
echo "Promotion complete" | ||
echo $version > version/version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source $(dirname $0)/common.sh | ||
repository=$(pwd)/distribution-repository | ||
|
||
pushd git-repo > /dev/null | ||
git fetch --tags --all > /dev/null | ||
popd > /dev/null | ||
|
||
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 = "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 | ||
|
||
git config user.name "Spring Buildmaster" > /dev/null | ||
git config user.email "buildmaster@springframework.org" > /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 --max-workers=4 -PdeploymentRepository=${repository} build publishAllPublicationsToDeploymentRepository | ||
|
||
git reset --hard HEAD^ > /dev/null | ||
if [[ $nextVersion != $snapshotVersion ]]; then | ||
echo "Setting next development version (v$nextVersion)" | ||
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 | ||
fi; | ||
|
||
echo "Staging Complete" | ||
|
||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
platform: linux | ||
inputs: | ||
- name: git-repo | ||
- name: artifactory-repo | ||
outputs: | ||
- name: version | ||
params: | ||
RELEASE_TYPE: | ||
ARTIFACTORY_SERVER: | ||
ARTIFACTORY_USERNAME: | ||
ARTIFACTORY_PASSWORD: | ||
BINTRAY_SUBJECT: | ||
BINTRAY_REPO: | ||
BINTRAY_USERNAME: | ||
BINTRAY_API_KEY: | ||
run: | ||
path: git-repo/ci/scripts/promote-version.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
platform: linux | ||
inputs: | ||
- name: git-repo | ||
outputs: | ||
- name: stage-git-repo | ||
- name: distribution-repository | ||
params: | ||
RELEASE_TYPE: | ||
CI: true | ||
GRADLE_ENTERPRISE_CACHE_USERNAME: | ||
GRADLE_ENTERPRISE_CACHE_PASSWORD: | ||
GRADLE_ENTERPRISE_URL: https://ge.spring.io | ||
caches: | ||
- path: gradle | ||
run: | ||
path: git-repo/ci/scripts/stage-version.sh |