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
This commit is contained in:
Artem Bilan
2023-11-07 10:42:08 -05:00
parent b1cd238d08
commit c2c4aec691
5 changed files with 55 additions and 54 deletions

View File

@@ -1,23 +0,0 @@
gradle.projectsLoaded {
rootProject {
artifactory {
publish {
defaults {
def zipArtifactProps =
['zip.name': 'spring-integration-aws',
'zip.displayname': 'Spring Integration Aws',
'zip.deployed': 'false']
properties {
mavenJava zipArtifactProps, '*:*:*:*@zip'
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
}
publications('mavenJava')
}
forkCount = 10
}
clientConfig.setConnectionRetries(4)
}
}
}

47
.github/spring-project-init.gradle vendored Normal file
View File

@@ -0,0 +1,47 @@
gradle.projectsLoaded {
rootProject {
// JFrog's build-info-extractor-gradle adds Gradle init script which does `apply plugin: ArtifactoryPlugin`
artifactory {
publish {
defaults {
def zipArtifactProps =
['zip.name': 'spring-integration-aws',
'zip.displayname': 'Spring Integration Aws',
'zip.deployed': 'false']
properties {
mavenJava zipArtifactProps, '*:*:*:*@zip'
mavenJava 'zip.type': 'docs', '*:*:*:docs@zip'
mavenJava 'zip.type': 'dist', '*:*:*:dist@zip'
}
publications('mavenJava')
}
forkCount = 10
}
clientConfig.setConnectionRetries(4)
}
// No need to have this task in project: only when we perform GHA
tasks.register('nextDevelopmentVersion') {
doLast {
if (!project.version.endsWith('-SNAPSHOT')) {
String nextDevelopmentVersion
if (project.version.contains('-M') || project.version.contains('-RC')) {
nextDevelopmentVersion = project.version - ~/(M|RC)\d+/ + 'SNAPSHOT'
}
else {
def versionParts = project.version.tokenize('.')
def major = versionParts[0]
def minor = versionParts[1]
def patch = versionParts[2] as int
nextDevelopmentVersion = major + '.' + minor + '.' + (++patch)+ '-SNAPSHOT'
}
def gradleProperties = file('gradle.properties')
def newProps = gradleProperties.text.replace(project.version, nextDevelopmentVersion)
gradleProperties.text = newProps
}
}
}
}
}

View File

@@ -35,11 +35,11 @@ jobs:
uses: actions/checkout@v4
with:
repository: spring-projects/spring-integration-aws
path: init
path: build
show-progress: false
- name: Copy the artifactory-init.gradle
run: rsync init/.github/artifactory-init.gradle ~/.gradle/init.d/
- name: Copy the spring-project-init.gradle
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
- uses: jfrog/setup-jfrog-cli@v3
with:
@@ -61,7 +61,7 @@ jobs:
- name: Build and Publish
run: |
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
jf gradle clean build ${{ inputs.gradleTasks }} artifactoryPublish
jf rt build-publish
- name: Tag Release and Next Development Version

View File

@@ -31,11 +31,11 @@ jobs:
uses: actions/checkout@v4
with:
repository: spring-projects/spring-integration-aws
path: init
path: build
show-progress: false
- name: Copy the artifactory-init.gradle
run: rsync init/.github/artifactory-init.gradle ~/.gradle/init.d/
- name: Copy the spring-project-init.gradle
run: rsync build/.github/spring-project-init.gradle ~/.gradle/init.d/
- uses: jfrog/setup-jfrog-cli@v3
with:
@@ -53,6 +53,6 @@ jobs:
- name: Build and Publish
run: |
jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
jf gradle clean build ${{ inputs.gradleTasks }} artifactoryPublish
jf rt build-publish

View File

@@ -276,27 +276,4 @@ task dist(dependsOn: assemble) {
description = 'Builds -dist and -docs distribution archives.'
}
tasks.register('nextDevelopmentVersion') {
onlyIf { isCI }
doLast {
if (!project.version.endsWith('-SNAPSHOT')) {
String nextDevelopmentVersion
if (project.version.contains('-M') || project.version.contains('-RC')) {
nextDevelopmentVersion = project.version - ~/(M|RC)\d+/ + 'SNAPSHOT'
}
else {
def versionParts = project.version.tokenize('.')
def major = versionParts[0]
def minor = versionParts[1]
def patch = versionParts[2] as int
nextDevelopmentVersion = major + '.' + minor + '.' + (++patch)+ '-SNAPSHOT'
}
def gradleProperties = file('gradle.properties')
def newProps = gradleProperties.text.replace(project.version, nextDevelopmentVersion)
gradleProperties.text = newProps
}
}
}
apply from: "${rootProject.projectDir}/publish-maven.gradle"