Skip to content

Commit 6dd5595

Browse files
committed
Add Milestone releases CI pipeline
1 parent bbf152a commit 6dd5595

10 files changed

+203
-2
lines changed

ci/config/changelog-generator.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
repository: spring-projects/spring-graphql
3+
sections:
4+
- title: ":star: New Features"
5+
labels:
6+
- "type: enhancement"
7+
- title: ":beetle: Bug Fixes"
8+
labels:
9+
- "type: bug"
10+
- "type: regression"
11+
- title: ":notebook_with_decorative_cover: Documentation"
12+
labels:
13+
- "type: documentation"
14+
- title: ":hammer: Dependency Upgrades"
15+
sort: "title"
16+
labels:
17+
- "type: dependency-upgrade"

ci/config/release-scripts.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
logging:
2+
level:
3+
io.spring.concourse: DEBUG
4+
spring:
5+
main:
6+
banner-mode: off

ci/parameters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github-repo: "https://github.com/spring-projects-experimental/spring-graphql.git"
2-
github-repo-name: "spring-projects-experimental/spring-graphql"
1+
github-repo: "https://github.com/spring-projects/spring-graphql.git"
2+
github-repo-name: "spring-projects/spring-graphql"
33
docker-hub-organization: "springci"
44
artifactory-server: "https://repo.spring.io"
55
branch: "main"

ci/pipeline.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ anchors:
77
GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key))
88
GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username))
99
GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password))
10+
artifactory-task-params: &artifactory-task-params
11+
ARTIFACTORY_SERVER: ((artifactory-server))
12+
ARTIFACTORY_USERNAME: ((artifactory-username))
13+
ARTIFACTORY_PASSWORD: ((artifactory-password))
1014

1115
resource_types:
1216
- name: artifactory-resource
@@ -88,9 +92,48 @@ jobs:
8892
threads: 8
8993
get_params:
9094
threads: 8
95+
- name: stage-milestone
96+
serial: true
97+
plan:
98+
- get: ci-image
99+
- get: git-repo
100+
trigger: false
101+
- task: stage
102+
image: ci-image
103+
file: git-repo/ci/tasks/stage-version.yml
104+
params:
105+
RELEASE_TYPE: M
106+
<<: *gradle-enterprise-task-params
107+
- put: artifactory-repo
108+
params:
109+
<<: *artifactory-params
110+
repo: libs-staging-local
111+
- put: git-repo
112+
params:
113+
repository: stage-git-repo
114+
- name: promote-milestone
115+
serial: true
116+
plan:
117+
- get: ci-image
118+
- get: git-repo
119+
trigger: false
120+
- get: artifactory-repo
121+
trigger: false
122+
passed: [stage-milestone]
123+
params:
124+
download_artifacts: false
125+
save_build_info: true
126+
- task: promote
127+
image: ci-image
128+
file: git-repo/ci/tasks/promote-version.yml
129+
params:
130+
RELEASE_TYPE: M
131+
<<: *artifactory-task-params
91132

92133
groups:
93134
- name: "builds"
94135
jobs: ["build"]
136+
- name: "releases"
137+
jobs: [ "stage-milestone", "promote-milestone" ]
95138
- name: "ci-images"
96139
jobs: ["build-ci-images"]

ci/scripts/generate-changelog.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
CONFIG_DIR=git-repo/ci/config
5+
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
6+
7+
java -jar /github-changelog-generator.jar \
8+
--spring.config.location=${CONFIG_DIR}/changelog-generator.yml \
9+
${version} generated-changelog/changelog.md
10+
11+
echo ${version} > generated-changelog/version
12+
echo v${version} > generated-changelog/tag

ci/scripts/promote-version.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
source $(dirname $0)/common.sh
4+
CONFIG_DIR=git-repo/ci/config
5+
6+
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
7+
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json
8+
9+
java -jar /opt/concourse-release-scripts.jar \
10+
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
11+
publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION artifactory-repo || { exit 1; }
12+
13+
java -jar /opt/concourse-release-scripts.jar \
14+
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
15+
promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; }
16+
17+
echo "Promotion complete"
18+
echo $version > version/version

ci/scripts/stage-version.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source $(dirname $0)/common.sh
5+
repository=$(pwd)/distribution-repository
6+
7+
pushd git-repo > /dev/null
8+
git fetch --tags --all > /dev/null
9+
popd > /dev/null
10+
11+
git clone git-repo stage-git-repo > /dev/null
12+
13+
pushd stage-git-repo > /dev/null
14+
15+
snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
16+
if [[ $RELEASE_TYPE = "M" ]]; then
17+
stageVersion=$( get_next_milestone_release $snapshotVersion)
18+
nextVersion=$snapshotVersion
19+
elif [[ $RELEASE_TYPE = "RC" ]]; then
20+
stageVersion=$( get_next_rc_release $snapshotVersion)
21+
nextVersion=$snapshotVersion
22+
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
23+
stageVersion=$( get_next_release $snapshotVersion)
24+
nextVersion=$( bump_version_number $snapshotVersion)
25+
else
26+
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
27+
fi
28+
29+
echo "Staging $stageVersion (next version will be $nextVersion)"
30+
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
31+
32+
git config user.name "Spring Buildmaster" > /dev/null
33+
git config user.email "[email protected]" > /dev/null
34+
git add gradle.properties > /dev/null
35+
git commit -m"Release v$stageVersion" > /dev/null
36+
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
37+
38+
./gradlew --no-daemon --max-workers=4 -PdeploymentRepository=${repository} build publishAllPublicationsToDeploymentRepository
39+
40+
git reset --hard HEAD^ > /dev/null
41+
if [[ $nextVersion != $snapshotVersion ]]; then
42+
echo "Setting next development version (v$nextVersion)"
43+
sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
44+
git add gradle.properties > /dev/null
45+
git commit -m"Next development version (v$nextVersion)" > /dev/null
46+
fi;
47+
48+
echo "Staging Complete"
49+
50+
popd > /dev/null

ci/tasks/generate-changelog.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
platform: linux
3+
image_resource:
4+
type: registry-image
5+
source:
6+
repository: springio/github-changelog-generator
7+
tag: '0.0.6'
8+
inputs:
9+
- name: git-repo
10+
- name: artifactory-repo
11+
outputs:
12+
- name: generated-changelog
13+
params:
14+
GITHUB_ORGANIZATION:
15+
GITHUB_REPO:
16+
GITHUB_USERNAME:
17+
GITHUB_TOKEN:
18+
RELEASE_TYPE:
19+
run:
20+
path: git-repo/ci/scripts/generate-changelog.sh

ci/tasks/promote-version.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
platform: linux
3+
inputs:
4+
- name: git-repo
5+
- name: artifactory-repo
6+
outputs:
7+
- name: version
8+
params:
9+
RELEASE_TYPE:
10+
ARTIFACTORY_SERVER:
11+
ARTIFACTORY_USERNAME:
12+
ARTIFACTORY_PASSWORD:
13+
SONATYPE_USER:
14+
SONATYPE_PASSWORD:
15+
SONATYPE_URL:
16+
SONATYPE_STAGING_PROFILE_ID:
17+
run:
18+
path: git-repo/ci/scripts/promote-version.sh

ci/tasks/stage-version.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
platform: linux
3+
inputs:
4+
- name: git-repo
5+
outputs:
6+
- name: stage-git-repo
7+
- name: distribution-repository
8+
params:
9+
RELEASE_TYPE:
10+
CI: true
11+
GRADLE_ENTERPRISE_CACHE_USERNAME:
12+
GRADLE_ENTERPRISE_CACHE_PASSWORD:
13+
GRADLE_ENTERPRISE_URL: https://ge.spring.io
14+
caches:
15+
- path: gradle
16+
run:
17+
path: git-repo/ci/scripts/stage-version.sh

0 commit comments

Comments
 (0)