Skip to content

Commit e75c931

Browse files
committed
Add workflow to release from GitHub Actions
Co-Authored-By: Moritz Halbritter <[email protected]> Closes gh-40407
1 parent bc5777d commit e75c931

File tree

12 files changed

+353
-6
lines changed

12 files changed

+353
-6
lines changed

.github/actions/build/action.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
name: 'Build'
2+
description: 'Builds the project, optionally publishing it to a local deployment repository'
23
inputs:
34
java-version:
45
required: false
5-
type: string
66
default: '17'
77
description: 'The Java version to compile and test with'
88
java-toolchain:
99
required: false
10-
type: boolean
1110
default: false
1211
description: 'Whether a Java toolchain should be used'
1312
publish:
1413
required: false
15-
type: boolean
1614
default: false
1715
description: 'Whether to publish artifacts ready for deployment to Artifactory'
1816
gradle-enterprise-secret-access-key:
1917
required: false
20-
type: string
2118
description: 'The secret access key for authentication with ge.spring.io'
2219
gradle-enterprise-cache-user:
2320
required: false
24-
type: string
2521
description: 'The username for authentication with the remote build cache'
2622
gradle-enterprise-cache-password:
2723
required: false
28-
type: string
2924
description: 'The password for authentication with the remote build cache'
3025
outputs:
3126
build-scan-url:
27+
description: 'The URL, if any, of the build scan produced by the build'
3228
value: ${{ (inputs.publish && steps.build-and-publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }}
3329
version:
30+
description: 'The version that was built'
3431
value: ${{ steps.read-version.outputs.version }}
3532
runs:
3633
using: composite
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Create GitHub Release
2+
description: Create the release on GitHub with a changelog
3+
inputs:
4+
milestone:
5+
description: Name of the GitHub milestone for which a release will be created
6+
required: true
7+
token:
8+
description: Token to use for authentication with GitHub
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Generate Changelog
14+
uses: spring-io/github-changelog-generator@052892c62af51f8af87a9da6de55e70864b7df12
15+
with:
16+
milestone: ${{ inputs.milestone }}
17+
token: ${{ inputs.token }}
18+
config-file: ${{ github.action_path }}/changelog-generator.yml
19+
- name: Create GitHub Release
20+
env:
21+
GITHUB_TOKEN: ${{ inputs.token }}
22+
shell: bash
23+
run: gh release create ${{ github.ref_name }} --notes-file changelog.md
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
changelog:
2+
repository: spring-projects/spring-boot
3+
sections:
4+
- title: ":star: New Features"
5+
labels:
6+
- "type: enhancement"
7+
- title: ":lady_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"
18+
issues:
19+
ports:
20+
- label: "status: forward-port"
21+
bodyExpression: 'Forward port of issue #(\d+).*'
22+
- label: "status: back-port"
23+
bodyExpression: 'Back port of issue #(\d+).*'
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Gradle Plugin
2+
description: Publishes Spring Boot's Gradle plugin to the Plugin Portal
3+
inputs:
4+
jfrog-cli-config-token:
5+
description: 'Config token for the JFrog CLI'
6+
required: true
7+
plugin-version:
8+
description: 'Version of the plugin'
9+
required: true
10+
gradle-plugin-publish-key:
11+
description: 'Gradle publishing key'
12+
required: true
13+
gradle-plugin-publish-secret:
14+
description: 'Gradle publishing secret'
15+
required: true
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Set Up JFrog CLI
20+
uses: jfrog/setup-jfrog-cli@d82fe26823e1f25529250895d5673f65b02af085 # v4.0.1
21+
env:
22+
JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }}
23+
- name: Download Artifacts
24+
shell: bash
25+
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-boot-{0}', inputs.plugin-version) }};buildNumber=${{ github.run_number }}'
26+
- name: Publish
27+
shell: bash
28+
run: >
29+
./gradlew publishExisting
30+
-p ${{ github.action_path }}
31+
-Pgradle.publish.key=${{ inputs.gradle-plugin-publish-key }}
32+
-Pgradle.publish.secret=${{ inputs.gradle-plugin-publish-secret }}
33+
-PbootVersion=${{ inputs.plugin-version }}
34+
-PrepositoryRoot=$(pwd)/repository
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files": [
3+
{
4+
"aql": {
5+
"items.find": {
6+
"$and": [
7+
{
8+
"@build.name": "${buildName}",
9+
"@build.number": "${buildNumber}",
10+
"path": {
11+
"$match": "org/springframework/boot/spring-boot-gradle-plugin/*"
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"target": "repository/"
18+
}
19+
]
20+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id "com.gradle.plugin-publish" version "1.2.1"
3+
}
4+
5+
tasks.register("publishExisting", com.gradle.publish.PublishExistingTask) {
6+
pluginId = "org.springframework.boot"
7+
fileRepositoryRoot = new File("${repositoryRoot}")
8+
pluginVersion = "${bootVersion}"
9+
pluginCoordinates = "org.springframework.boot:spring-boot-gradle-plugin:${bootVersion}"
10+
displayName = "Spring Boot Gradle Plugin"
11+
pluginDescription = "Spring Boot Gradle Plugin"
12+
website = "https://spring.io/projects/spring-boot"
13+
vcsUrl = "https://github.com/spring-projects/spring-boot"
14+
}

.github/actions/publish-gradle-plugin/settings.gradle

Whitespace-only changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to SDKMAN!
2+
description: Publishes the release as a new candidate version on SDKMAN!
3+
inputs:
4+
sdkman-consumer-key:
5+
description: 'Key for publishing to SDKMAN!'
6+
required: true
7+
sdkman-consumer-secret:
8+
description: 'Secret for publishing to SDKMAN!'
9+
required: true
10+
spring-boot-version:
11+
description: 'The version to publish'
12+
required: true
13+
make-default:
14+
description: 'Whether the release should be made the default version'
15+
required: false
16+
default: false
17+
runs:
18+
using: composite
19+
steps:
20+
- shell: bash
21+
run: >
22+
curl -X POST \
23+
-H "Consumer-Key: ${{ inputs.sdkman-consumer-key }}"
24+
-H "Consumer-Token: ${{ inputs.sdkman-consumer-token }}"
25+
-H "Content-Type: application/json"
26+
-H "Accept: application/json"
27+
-d '{"candidate": "springboot", "version": "${{ inputs.spring-boot-version }}", "url": "${{ format('https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-cli/{0}/spring-boot-cli-{0}-bin.zip', inputs.spring-boot-version)"}'
28+
https://vendors.sdkman.io/release
29+
- shell: bash
30+
if: ${{ inputs.make-default }}
31+
run: >
32+
curl -X POST \
33+
-H "Consumer-Key: ${{ inputs.sdkman-consumer-key }}"
34+
-H "Consumer-Token: ${{ inputs.sdkman-consumer-token }}"
35+
-H "Content-Type: application/json"
36+
-H "Accept: application/json"
37+
-d '{"candidate": "springboot", "version": "${{ inputs.spring-boot-version }}"}'
38+
https://vendors.sdkman.io/default
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Sync to Maven Central
2+
description: Syncs a release to Maven Central and waits for it to be available for use
3+
inputs:
4+
jfrog-cli-config-token:
5+
description: 'Config token for the JFrog CLI'
6+
required: true
7+
spring-boot-version:
8+
description: 'The version of Spring Boot that is being synced to Central'
9+
required: true
10+
ossrh-s01-token-username:
11+
description: 'Username for authentication with s01.oss.sonatype.org'
12+
required: true
13+
ossrh-s01-token-password:
14+
description: 'Password for authentication with s01.oss.sonatype.org'
15+
required: true
16+
ossrh-s01-staging-profile:
17+
description: 'Staging profile to use when syncing to Central'
18+
required: true
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Set Up JFrog CLI
23+
uses: jfrog/setup-jfrog-cli@d82fe26823e1f25529250895d5673f65b02af085 # v4.0.1
24+
env:
25+
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
26+
- name: Download Release Artifacts
27+
shell: bash
28+
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-boot-{0}', inputs.spring-boot-version) }};buildNumber=${{ github.run_number }}'
29+
- name: Sync
30+
uses: spring-io/nexus-sync-action@42477a2230a2f694f9eaa4643fa9e76b99b7ab84 # v0.0.1
31+
with:
32+
username: ${{ inputs.ossrh-s01-token-username }}
33+
password: ${{ inputs.ossrh-s01-token-password }}
34+
staging-profile-name: ${{ secrets.ossrh-s01-staging-profile }}
35+
create: true
36+
upload: true
37+
close: true
38+
release: true
39+
generate-checksums: true
40+
- name: Await
41+
shell: bash
42+
run: |
43+
url=${{ format('https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot/{0}/spring-boot-{0}.jar', inputs.spring-boot-version) }}
44+
echo "Waiting for $url"
45+
until curl --fail --head --silent $url > /dev/null
46+
do
47+
echo "."
48+
sleep 60
49+
done
50+
echo "$url is available"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files": [
3+
{
4+
"aql": {
5+
"items.find": {
6+
"$and": [
7+
{
8+
"@build.name": "${buildName}",
9+
"@build.number": "${buildNumber}",
10+
"path": {
11+
"$nmatch": "org/springframework/boot/spring-boot-docs/*"
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"target": "nexus/"
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)