Skip to content

Commit c2c4aec

Browse files
committed
Some workflows improvements
* Move `nextDevelopmentVersion` Gradle task to the `spring-project-init.gradle` * Checkout common repo to the `build` dir which is then cleaned by Gradle
1 parent b1cd238 commit c2c4aec

File tree

5 files changed

+55
-54
lines changed

5 files changed

+55
-54
lines changed

.github/artifactory-init.gradle

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/spring-project-init.gradle

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
gradle.projectsLoaded {
2+
rootProject {
3+
// JFrog's build-info-extractor-gradle adds Gradle init script which does `apply plugin: ArtifactoryPlugin`
4+
artifactory {
5+
publish {
6+
defaults {
7+
def zipArtifactProps =
8+
['zip.name': 'spring-integration-aws',
9+
'zip.displayname': 'Spring Integration Aws',
10+
'zip.deployed': 'false']
11+
properties {
12+
mavenJava zipArtifactProps, '*:*:*:*@zip'
13+
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
14+
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
15+
}
16+
17+
publications('mavenJava')
18+
}
19+
forkCount = 10
20+
}
21+
clientConfig.setConnectionRetries(4)
22+
}
23+
24+
// No need to have this task in project: only when we perform GHA
25+
tasks.register('nextDevelopmentVersion') {
26+
doLast {
27+
if (!project.version.endsWith('-SNAPSHOT')) {
28+
String nextDevelopmentVersion
29+
if (project.version.contains('-M') || project.version.contains('-RC')) {
30+
nextDevelopmentVersion = project.version - ~/(M|RC)\d+/ + 'SNAPSHOT'
31+
}
32+
else {
33+
def versionParts = project.version.tokenize('.')
34+
def major = versionParts[0]
35+
def minor = versionParts[1]
36+
def patch = versionParts[2] as int
37+
nextDevelopmentVersion = major + '.' + minor + '.' + (++patch)+ '-SNAPSHOT'
38+
}
39+
40+
def gradleProperties = file('gradle.properties')
41+
def newProps = gradleProperties.text.replace(project.version, nextDevelopmentVersion)
42+
gradleProperties.text = newProps
43+
}
44+
}
45+
}
46+
}
47+
}

.github/workflows/spring-artifactory-gradle-release-staging.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535
uses: actions/checkout@v4
3636
with:
3737
repository: spring-projects/spring-integration-aws
38-
path: init
38+
path: build
3939
show-progress: false
4040

41-
- name: Copy the artifactory-init.gradle
42-
run: rsync init/.github/artifactory-init.gradle ~/.gradle/init.d/
41+
- name: Copy the spring-project-init.gradle
42+
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
4343

4444
- uses: jfrog/setup-jfrog-cli@v3
4545
with:
@@ -61,7 +61,7 @@ jobs:
6161
6262
- name: Build and Publish
6363
run: |
64-
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
64+
jf gradle clean build ${{ inputs.gradleTasks }} artifactoryPublish
6565
jf rt build-publish
6666
6767
- name: Tag Release and Next Development Version

.github/workflows/spring-artifactory-gradle-snapshot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131
uses: actions/checkout@v4
3232
with:
3333
repository: spring-projects/spring-integration-aws
34-
path: init
34+
path: build
3535
show-progress: false
3636

37-
- name: Copy the artifactory-init.gradle
38-
run: rsync init/.github/artifactory-init.gradle ~/.gradle/init.d/
37+
- name: Copy the spring-project-init.gradle
38+
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
3939

4040
- uses: jfrog/setup-jfrog-cli@v3
4141
with:
@@ -53,6 +53,6 @@ jobs:
5353
5454
- name: Build and Publish
5555
run: |
56-
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
56+
jf gradle clean build ${{ inputs.gradleTasks }} artifactoryPublish
5757
jf rt build-publish
5858

build.gradle

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,27 +276,4 @@ task dist(dependsOn: assemble) {
276276
description = 'Builds -dist and -docs distribution archives.'
277277
}
278278

279-
tasks.register('nextDevelopmentVersion') {
280-
onlyIf { isCI }
281-
doLast {
282-
if (!project.version.endsWith('-SNAPSHOT')) {
283-
String nextDevelopmentVersion
284-
if (project.version.contains('-M') || project.version.contains('-RC')) {
285-
nextDevelopmentVersion = project.version - ~/(M|RC)\d+/ + 'SNAPSHOT'
286-
}
287-
else {
288-
def versionParts = project.version.tokenize('.')
289-
def major = versionParts[0]
290-
def minor = versionParts[1]
291-
def patch = versionParts[2] as int
292-
nextDevelopmentVersion = major + '.' + minor + '.' + (++patch)+ '-SNAPSHOT'
293-
}
294-
295-
def gradleProperties = file('gradle.properties')
296-
def newProps = gradleProperties.text.replace(project.version, nextDevelopmentVersion)
297-
gradleProperties.text = newProps
298-
}
299-
}
300-
}
301-
302279
apply from: "${rootProject.projectDir}/publish-maven.gradle"

0 commit comments

Comments
 (0)