Skip to content

Commit 70f3e08

Browse files
committed
Release from GitHub Actions
1 parent b5ed22b commit 70f3e08

File tree

10 files changed

+290
-0
lines changed

10 files changed

+290
-0
lines changed

.github/actions/build/action.yml

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ inputs:
44
develocity-access-key:
55
description: Access key for authentication with https://ge.spring.io
66
required: true
7+
outputs:
8+
version:
9+
description: 'The version that was built'
10+
value: ${{ steps.read-version.outputs.version }}
711
runs:
812
using: composite
913
steps:
@@ -26,3 +30,10 @@ runs:
2630
env:
2731
DEVELOCITY_ACCESS_KEY: ${{ inputs.develocity-access-key }}
2832
run: ./gradlew -PdeploymentRepository=$(pwd)/artifactory build publishAllPublicationsToDeploymentRepository
33+
- name: Read Version From gradle.properties
34+
id: read-version
35+
shell: bash
36+
run: |
37+
version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties)
38+
echo "Version is $version"
39+
echo "version=$version" >> $GITHUB_OUTPUT
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/actions/create-github-release/changelog-generator.yml
19+
- name: Create GitHub Release
20+
shell: bash
21+
env:
22+
GITHUB_TOKEN: ${{ inputs.token }}
23+
run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
changelog:
2+
repository: spring-gradle-plugins/dependency-management-plugin
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+).*'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Gradle Plugin
2+
description: Publishes the plugin to Gradle's 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+
build-number:
17+
description: 'The build number to use when downloading plugin artifacts'
18+
required: false
19+
default: ${{ github.run_number }}
20+
runs:
21+
using: composite
22+
steps:
23+
- name: Set Up JFrog CLI
24+
uses: jfrog/setup-jfrog-cli@d82fe26823e1f25529250895d5673f65b02af085 # v4.0.1
25+
env:
26+
JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }}
27+
- name: Download Artifacts
28+
shell: bash
29+
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('dependency-management-plugin-{0}', inputs.plugin-version) }};buildNumber=${{ inputs.build-number }}'
30+
- name: Set Up Java
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'liberica'
34+
java-version: '17'
35+
- name: Publish
36+
shell: bash
37+
working-directory: ${{ github.action_path }}
38+
run: ${{ github.workspace }}/gradlew publishExisting -Pgradle.publish.key=${{ inputs.gradle-plugin-publish-key }} -Pgradle.publish.secret=${{ inputs.gradle-plugin-publish-secret }} -PpluginVersion=${{ inputs.plugin-version }} -PrepositoryRoot=${{ github.workspace }}/gradle-plugin-portal
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": "io/spring/gradle/dependency-management-plugin/*"
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"target": "gradle-plugin-portal/"
18+
}
19+
]
20+
}
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 = "io.spring.dependency-management"
7+
fileRepositoryRoot = new File("${repositoryRoot}")
8+
pluginVersion = "${pluginVersion}"
9+
pluginCoordinates = "io.spring.gradle:dependency-management-plugin:${pluginVersion}"
10+
displayName = "Dependency Management Plugin"
11+
pluginDescription = "A Gradle plugin that provides Maven-like dependency management functionality"
12+
website = "https://github.com/spring-gradle-plugins/dependency-management-plugin"
13+
vcsUrl = "https://github.com/spring-gradle-plugins/dependency-management-plugin"
14+
}

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

Whitespace-only changes.
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+
version:
8+
description: 'The version 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: ${{ inputs.jfrog-cli-config-token }}
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('dependency-management-plugin-{0}', inputs.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: ${{ inputs.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/io/spring/gradle/dependency-management-plugin/{0}/dependency-management-plugin-{0}.jar', inputs.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"
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+
"name": {
11+
"$nmatch": "*docs*"
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"target": "nexus/"
18+
}
19+
]
20+
}

.github/workflows/release.yml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v1.1.[0-9]+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
jobs:
9+
build-and-stage-release:
10+
if: ${{ github.repository == 'spring-gradle-plugins/dependency-management-plugin' }}
11+
name: Build and Stage Release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check Out Code
15+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
16+
- name: Build
17+
id: build
18+
uses: ./.github/actions/build
19+
with:
20+
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
21+
- name: Stage Release
22+
uses: ./.github/actions/deploy-to-artifactory
23+
with:
24+
build-name-version: ${{ steps.build.outputs.version }}
25+
repository: 'libs-staging-local'
26+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
27+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
28+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
30+
outputs:
31+
version: ${{ steps.build.outputs.version }}
32+
sync-to-maven-central:
33+
name: Sync to Maven Central
34+
needs:
35+
- build-and-stage-release
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Check Out Code
39+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40+
- name: Sync to Maven Central
41+
uses: ./.github/actions/sync-to-maven-central
42+
with:
43+
jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }}
44+
ossrh-s01-staging-profile: ${{ secrets.OSSRH_S01_STAGING_PROFILE }}
45+
ossrh-s01-token-password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
46+
ossrh-s01-token-username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
47+
version: ${{ needs.build-and-stage-release.outputs.version }}
48+
promote-release:
49+
name: Promote Release
50+
needs:
51+
- build-and-stage-release
52+
- sync-to-maven-central
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Set up JFrog CLI
56+
uses: jfrog/setup-jfrog-cli@d82fe26823e1f25529250895d5673f65b02af085 # v4.0.1
57+
env:
58+
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
59+
- name: Promote build
60+
run: jfrog rt build-promote ${{ format('dependency-management-plugin-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} plugins-release-local
61+
publish-to-plugin-portal:
62+
name: Publish to Plugin Portal
63+
needs:
64+
- build-and-stage-release
65+
- sync-to-maven-central
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Check Out Code
69+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
70+
- name: Publish
71+
uses: ./.github/actions/publish-to-plugin-portal
72+
with:
73+
gradle-plugin-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY_CREDENTIAL }}
74+
gradle-plugin-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET_CREDENTIAL }}
75+
jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }}
76+
plugin-version: ${{ needs.build-and-stage-release.outputs.version }}
77+
create-github-release:
78+
name: Create GitHub Release
79+
needs:
80+
- build-and-stage-release
81+
- promote-release
82+
- publish-to-plugin-portal
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Check Out Code
86+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87+
- name: Create GitHub Release
88+
uses: ./.github/actions/create-github-release
89+
with:
90+
milestone: ${{ needs.build-and-stage-release.outputs.version }}
91+
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}

0 commit comments

Comments
 (0)