Skip to content

Commit 891aa75

Browse files
committed
Publish releases to Maven Central
Closes gh-72
1 parent 8f00e68 commit 891aa75

File tree

5 files changed

+32
-51
lines changed

5 files changed

+32
-51
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
}
1010

1111
group = 'io.spring.asciidoctor.backends'
12+
description = 'Spring Asciidoctor Backends'
1213

1314
apply from: "$rootDir/gradle/publish-maven.gradle"
1415

ci/config/release-scripts.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
spring:
2+
main:
3+
banner-mode: off
4+
sonatype:
5+
exclude:
6+
- 'build-info\.json'

ci/pipeline.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ jobs:
183183
- name: promote-milestone
184184
serial: true
185185
plan:
186-
- get: ci-image
187186
- get: git-repo
188187
trigger: false
189188
- get: artifactory-repo
@@ -192,7 +191,6 @@ jobs:
192191
params:
193192
save_build_info: true
194193
- task: promote
195-
image: ci-image
196194
file: git-repo/ci/tasks/promote.yml
197195
params:
198196
RELEASE_TYPE: M
@@ -211,7 +209,6 @@ jobs:
211209
- name: promote-rc
212210
serial: true
213211
plan:
214-
- get: ci-image
215212
- get: git-repo
216213
trigger: false
217214
- get: artifactory-repo
@@ -221,7 +218,6 @@ jobs:
221218
download_artifacts: false
222219
save_build_info: true
223220
- task: promote
224-
image: ci-image
225221
file: git-repo/ci/tasks/promote.yml
226222
params:
227223
RELEASE_TYPE: RC
@@ -240,7 +236,6 @@ jobs:
240236
- name: promote-release
241237
serial: true
242238
plan:
243-
- get: ci-image
244239
- get: git-repo
245240
trigger: false
246241
- get: artifactory-repo
@@ -250,22 +245,14 @@ jobs:
250245
download_artifacts: true
251246
save_build_info: true
252247
- task: promote
253-
image: ci-image
254248
file: git-repo/ci/tasks/promote.yml
255249
params:
256250
RELEASE_TYPE: RELEASE
257251
<<: *artifactory-task-params
258-
- name: create-github-release
259-
serial: true
260-
plan:
261-
- get: ci-image
262-
- get: git-repo
263-
- get: artifactory-repo
264-
trigger: true
265-
passed: [promote-release]
266-
params:
267-
download_artifacts: false
268-
save_build_info: true
252+
SONATYPE_USERNAME: ((s01-user-token))
253+
SONATYPE_PASSWORD: ((s01-user-token-password))
254+
SONATYPE_URL: ((sonatype-url))
255+
SONATYPE_STAGING_PROFILE_ID: ((sonatype-staging-profile-id))
269256
- task: generate-changelog
270257
file: git-repo/ci/tasks/generate-changelog.yml
271258
params:
@@ -281,7 +268,7 @@ groups:
281268
- name: "builds"
282269
jobs: ["build"]
283270
- name: "releases"
284-
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
271+
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release"]
285272
- name: "ci-image"
286273
jobs: ["build-ci-image"]
287274

ci/scripts/promote.sh

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,17 @@
11
#!/bin/bash
2-
set -e
32

4-
source $(dirname $0)/common.sh
3+
CONFIG_DIR=git-repo/ci/config
54

6-
buildName=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.name' )
7-
buildNumber=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.number' )
85
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
6+
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json
97

8+
java -jar /concourse-release-scripts.jar \
9+
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
10+
publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION artifactory-repo || { exit 1; }
1011

11-
if [[ $RELEASE_TYPE = "M" ]]; then
12-
targetRepo="libs-milestone-local"
13-
elif [[ $RELEASE_TYPE = "RC" ]]; then
14-
targetRepo="libs-milestone-local"
15-
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
16-
targetRepo="libs-release-local"
17-
else
18-
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
19-
fi
20-
21-
echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}"
22-
23-
curl \
24-
-s \
25-
--connect-timeout 240 \
26-
--max-time 900 \
27-
-u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \
28-
-H "Content-type:application/json" \
29-
-d "{\"status\": \"staged\", \"sourceRepo\": \"libs-staging-local\", \"targetRepo\": \"${targetRepo}\"}" \
30-
-f \
31-
-X \
32-
POST "${ARTIFACTORY_SERVER}/api/build/promote/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to promote" >&2; exit 1; }
12+
java -jar /concourse-release-scripts.jar \
13+
--spring.config.location=${CONFIG_DIR}/release-scripts.yml \
14+
promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; }
3315

3416
echo "Promotion complete"
35-
echo $version > version/version
17+
echo $version > version/version

ci/tasks/promote.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
---
22
platform: linux
3+
image_resource:
4+
type: registry-image
5+
source:
6+
repository: springio/concourse-release-scripts
7+
tag: '0.3.4'
38
inputs:
49
- name: git-repo
510
- name: artifactory-repo
611
outputs:
712
- name: version
813
params:
9-
RELEASE_TYPE:
1014
ARTIFACTORY_SERVER:
1115
ARTIFACTORY_USERNAME:
1216
ARTIFACTORY_PASSWORD:
13-
BINTRAY_SUBJECT:
14-
BINTRAY_REPO:
15-
BINTRAY_USERNAME:
16-
BINTRAY_API_KEY:
17+
RELEASE_TYPE:
18+
SONATYPE_USER:
19+
SONATYPE_PASSWORD:
20+
SONATYPE_URL:
21+
SONATYPE_STAGING_PROFILE:
1722
run:
18-
path: git-repo/ci/scripts/promote.sh
23+
path: git-repo/ci/scripts/promote.sh

0 commit comments

Comments
 (0)