From 9bc66e5be00ee28d444a0155249a65fa930e95f5 Mon Sep 17 00:00:00 2001 From: Timon Back Date: Thu, 2 May 2024 21:12:12 +0200 Subject: [PATCH 1/4] chore: use gradle-nexus plugin for automatic artifact publishing --- .github/workflows/publish-releases.yml | 1 - .github/workflows/springwolf-addons.yml | 1 - .github/workflows/springwolf-asyncapi.yml | 1 - .github/workflows/springwolf-bindings.yml | 1 - .github/workflows/springwolf-core.yml | 1 - .github/workflows/springwolf-plugins.yml | 1 - .github/workflows/springwolf-ui.yml | 1 - build.gradle | 22 ++++++++++++---------- 8 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish-releases.yml b/.github/workflows/publish-releases.yml index 3f6b52e1c..7e0c07618 100644 --- a/.github/workflows/publish-releases.yml +++ b/.github/workflows/publish-releases.yml @@ -35,7 +35,6 @@ jobs: env: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-addons.yml b/.github/workflows/springwolf-addons.yml index e2371cb9a..f3ffbbba0 100644 --- a/.github/workflows/springwolf-addons.yml +++ b/.github/workflows/springwolf-addons.yml @@ -51,6 +51,5 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-asyncapi.yml b/.github/workflows/springwolf-asyncapi.yml index d5b300468..f1fe7775f 100644 --- a/.github/workflows/springwolf-asyncapi.yml +++ b/.github/workflows/springwolf-asyncapi.yml @@ -40,6 +40,5 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-bindings.yml b/.github/workflows/springwolf-bindings.yml index 5a9b79380..1e86fa0dc 100644 --- a/.github/workflows/springwolf-bindings.yml +++ b/.github/workflows/springwolf-bindings.yml @@ -51,6 +51,5 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-core.yml b/.github/workflows/springwolf-core.yml index 327fb4f75..e524a3fb7 100644 --- a/.github/workflows/springwolf-core.yml +++ b/.github/workflows/springwolf-core.yml @@ -40,6 +40,5 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-plugins.yml b/.github/workflows/springwolf-plugins.yml index 9942e23cc..77947b9af 100644 --- a/.github/workflows/springwolf-plugins.yml +++ b/.github/workflows/springwolf-plugins.yml @@ -70,6 +70,5 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/springwolf-ui.yml b/.github/workflows/springwolf-ui.yml index a265b3da6..ea1c5f9bb 100644 --- a/.github/workflows/springwolf-ui.yml +++ b/.github/workflows/springwolf-ui.yml @@ -46,7 +46,6 @@ jobs: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} - ORG_GRADLE_PROJECT_MAVEN_URL: https://s01.oss.sonatype.org/content/repositories/snapshots/ ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/build.gradle b/build.gradle index d157f7df2..4145aaef4 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ buildscript { } plugins { + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'ca.cutterslade.analyze' version '1.9.1' id 'io.spring.dependency-management' version '1.1.4' apply false id 'org.springframework.boot' version '3.2.5' apply false @@ -212,16 +213,6 @@ allprojects { } } } - - repositories { - maven { - url = project.findProperty('MAVEN_URL') - credentials { - username = project.findProperty('MAVEN_USERNAME') ?: '' - password = project.findProperty('MAVEN_PASSWORD') ?: '' - } - } - } } signing { @@ -246,6 +237,17 @@ allprojects { } } +nexusPublishing { + repositories { + MavenRepository { + nexusUrl = uri('https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/') + snapshotRepositoryUrl = uri('https://s01.oss.sonatype.org/content/repositories/snapshots/') + username = project.findProperty('MAVEN_USERNAME') ?: '' + password = project.findProperty('MAVEN_PASSWORD') ?: '' + } + } +} + dependencyCheck { outputDirectory = "${rootProject.layout.buildDirectory.get().asFile}/reports/owasp-dependency-check" formats = [ReportGenerator.Format.SARIF.toString()] From 888aaa0f6d410e1c2855531d99d46e8ec413dbef Mon Sep 17 00:00:00 2001 From: Timon Back Date: Thu, 2 May 2024 21:13:36 +0200 Subject: [PATCH 2/4] refactor: move gradle task updateAsyncApiJson to other tasks --- build.gradle | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 4145aaef4..08899af9e 100644 --- a/build.gradle +++ b/build.gradle @@ -92,7 +92,6 @@ allprojects { exceptionFormat = 'full' } } - tasks.register('unitTest', Test) { enabled = !it.project.name.contains("-example") // Examples do not contain unit tests and would fail otherwise dependsOn spotlessApply // Automatically fix code formatting if possible @@ -111,8 +110,6 @@ allprojects { exceptionFormat = 'full' } } - - tasks.register('integrationTest', Test) { dependsOn spotlessApply // Automatically fix code formatting if possible @@ -131,6 +128,19 @@ allprojects { } } + tasks.register('updateAsyncApiJson') { + group 'verification' + description 'Update the AsyncAPI JSON files in the examples to match the current state of the plugin' + + doLast { // ensure that the code is not executed as part of a gradle refresh + plugins.forEach { + project + .file('springwolf-examples/' + it + '-example/src/test/resources/asyncapi.actual.json') + .renameTo('springwolf-examples/' + it + '-example/src/test/resources/asyncapi.json') + } + } + } + var addons = [ 'springwolf-common-model-converters' , 'springwolf-generic-binding' , @@ -222,19 +232,6 @@ allprojects { useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mavenJava } - - tasks.register('updateAsyncApiJson') { - group 'verification' - description 'Update the AsyncAPI JSON files in the examples to match the current state of the plugin' - - doLast { // ensure that the code is not executed as part of a gradle refresh - plugins.forEach { - project - .file('springwolf-examples/' + it + '-example/src/test/resources/asyncapi.actual.json') - .renameTo('springwolf-examples/' + it + '-example/src/test/resources/asyncapi.json') - } - } - } } nexusPublishing { From a7cece0e0dba4321ebcfcc5767aa4aea33243b9d Mon Sep 17 00:00:00 2001 From: Timon Back Date: Thu, 2 May 2024 21:40:03 +0200 Subject: [PATCH 3/4] docs: update RELEASING.md --- RELEASING.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index dbc561e36..eeb59f6db 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -13,9 +13,5 @@ The following list describe the steps necessary to release a new version. 3. Update `all-contributors` in [README.md](README.md) 4. Remove the `-SNAPHSOT` postfix in `.env`, create a new branch `release/0.X.X` (version number), commit & push 5. Run GitHub `Publish releases` pipeline from the newly created release branch - 1. The stage artifacts can be viewed in https://s01.oss.sonatype.org/#view-repositories - 2. To view them, select `Nexus Managed Repositories` in the drop-down and search for springwolf in the searchbox -6. Release version in nexus - 1. Artifacts are visible in the public maven repository: https://repo1.maven.org/maven2/io/github/springwolf/ -7. Update version number on website -8. Update the version number in `.env` for next snapshot on branch `master`, commit & push +6. Update version number on website +7. Update the version number in `.env` for next snapshot on branch `master`, commit & push From 4bd863125791dfc835123a5e7c995ef22fb3f318 Mon Sep 17 00:00:00 2001 From: Timon Back Date: Fri, 3 May 2024 15:20:15 +0200 Subject: [PATCH 4/4] chore(gh): automatically publish nexus release in release pipeline --- .github/workflows/publish-releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-releases.yml b/.github/workflows/publish-releases.yml index 7e0c07618..587355318 100644 --- a/.github/workflows/publish-releases.yml +++ b/.github/workflows/publish-releases.yml @@ -31,7 +31,7 @@ jobs: ORG_GRADLE_PROJECT_DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - name: Publish maven artifacts - run: ./gradlew publish + run: ./gradlew publish closeAndReleaseStagingRepositories env: ORG_GRADLE_PROJECT_SIGNINGKEY: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}}