From 85aa23253fc008c19ceda5689c710e709a1441d4 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Fri, 12 Apr 2024 09:18:00 -0400 Subject: [PATCH 01/17] remove deprecated jacoco stuff for now --- build.gradle | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/build.gradle b/build.gradle index e787ed4..022ec42 100644 --- a/build.gradle +++ b/build.gradle @@ -45,30 +45,6 @@ allprojects { // Only report code coverage for published projects def publishedProjects = subprojects.findAll { it.path != ':openapi-perf-checker' } -task jacocoMerge(type: JacocoMerge) { - publishedProjects.each { subproject -> - executionData subproject.tasks.withType(Test) - } - doFirst { - executionData = files(executionData.findAll { it.exists() }) - } -} - -task codeCoverageReport(type: JacocoReport) { - dependsOn publishedProjects.test, jacocoMerge - - additionalSourceDirs.from = files(publishedProjects.sourceSets.main.allSource.srcDirs) - sourceDirectories.from = files(publishedProjects.sourceSets.main.allSource.srcDirs) - classDirectories.from = files(publishedProjects.sourceSets.main.output) - executionData jacocoMerge.destinationFile - - reports { - xml.enabled true - html.enabled true - csv.enabled false - } -} - sonarqube { properties { property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/codeCoverageReport/codeCoverageReport.xml" From 91a696f8b36ebee70b3d5aaf8168d12ac359a78f Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Fri, 12 Apr 2024 09:18:14 -0400 Subject: [PATCH 02/17] upgrade dependencies --- gradle/wrapper/gradle-wrapper.properties | 2 +- .../openapi-operation-undertow/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 484e9e3..59510f8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Sat Nov 02 20:18:41 CET 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/openapi-operation-adapters/openapi-operation-undertow/build.gradle b/openapi-operation-adapters/openapi-operation-undertow/build.gradle index f192d87..0fc4589 100644 --- a/openapi-operation-adapters/openapi-operation-undertow/build.gradle +++ b/openapi-operation-adapters/openapi-operation-undertow/build.gradle @@ -12,7 +12,7 @@ dependencies { implementation("io.undertow:undertow-core:2.0.1.Final") testImplementation("junit:junit:4.13.2") - testImplementation("org.mockito:mockito-inline:3.1.0") + testImplementation("org.mockito:mockito-core:5.11.0") } apply from: "../../publish.gradle" From 35959f5362b946d57f5beb715dce804329beeca9 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Fri, 12 Apr 2024 15:59:47 -0400 Subject: [PATCH 03/17] add start of attempt at failing test for path collision bug --- .../validation/RequestValidatorTest.java | 16 + .../test/resources/request/pathCollision.yaml | 337 ++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 openapi-operation-validator/src/test/resources/request/pathCollision.yaml diff --git a/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java b/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java index 539fbe8..2ac39df 100644 --- a/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java +++ b/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java @@ -132,6 +132,22 @@ public void withServerPathFindOperationCheck() throws Exception { true); } + @Test + // Right now this test is a little flaky, there is a small chance that this will throw a false positive, due to the 'randomness' of how the pathPatterns are formed + // Multiple resources on /greeting/{id} in yaml should reduce the chance + public void withPathCollision() throws Exception { + URL specPath = RequestValidatorTest.class.getResource("/request/pathCollision.yaml"); + OpenApi3 api = new OpenApi3Parser().parse(specPath, false); + RequestValidator requestValidator = new RequestValidator(api); + + checkRequest( + api, + "greetingBySpanishResource", + requestValidator, + new DefaultRequest.Builder("https://api.com/greeting/spanish", GET).build(), + true); + } + @Test public void responseTest() throws Exception { URL specPath = RequestValidatorTest.class.getResource("/request/requestValidator-with-servers.yaml"); diff --git a/openapi-operation-validator/src/test/resources/request/pathCollision.yaml b/openapi-operation-validator/src/test/resources/request/pathCollision.yaml new file mode 100644 index 0000000..981b7f4 --- /dev/null +++ b/openapi-operation-validator/src/test/resources/request/pathCollision.yaml @@ -0,0 +1,337 @@ +openapi: 3.0.0 +info: + title: hello-api + version: '1.0' +paths: + /greeting/{id}: + patch: + operationId: patchGreetingById + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/a: + patch: + operationId: patchGreetingByIdAndA + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/b: + patch: + operationId: patchGreetingByIdAndB + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/spanish: + get: + operationId: greetingBySpanishResource + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/c: + patch: + operationId: patchGreetingByIdAndC + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/d: + patch: + operationId: patchGreetingByIdAndD + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/e: + patch: + operationId: patchGreetingByIdAndE + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/f: + patch: + operationId: patchGreetingByIdAndF + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/g: + patch: + operationId: patchGreetingByIdAndG + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/h: + patch: + operationId: patchGreetingByIdAndH + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/i: + patch: + operationId: patchGreetingByIdAndI + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string + /greeting/{id}/j: + patch: + operationId: patchGreetingByIdAndJ + parameters: + - name: id + in: path + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + type: object + required: + - caller + properties: + caller: + type: string + responses: + 200: + description: greeting response + content: + application/json: + schema: + type: object + properties: + greeting: + type: string From 4110d6c9dc9712a52497ab1ca264d1226bf513d2 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Mon, 15 Apr 2024 16:16:32 -0400 Subject: [PATCH 04/17] fix ordering of hashmap so concrete definitions are moved to top concrete definition per the spec: /pets/mine not concrete: /pets/{petId} --- .../validation/RequestValidator.java | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java b/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java index c95fe8b..ad9c474 100644 --- a/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java +++ b/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java @@ -13,10 +13,7 @@ import org.openapi4j.schema.validator.ValidationContext; import org.openapi4j.schema.validator.ValidationData; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; @@ -316,9 +313,33 @@ private void validateResponse(final Response response, } private Map buildPathPatterns() { - Map patterns = new HashMap<>(); + Map patterns = new LinkedHashMap<>(); - for (Map.Entry pathEntry : openApi.getPaths().entrySet()) { + Map paths = openApi.getPaths(); + + List > list = new LinkedList<>(paths.entrySet()); + + Comparator> comparator = (entry1, entry2) -> { + boolean key1ContainsCurlyBrace = entry1.getKey().contains("{"); + boolean key2ContainsCurlyBrace = entry2.getKey().contains("{"); + + if (!key1ContainsCurlyBrace && key2ContainsCurlyBrace) { + return -1; + } else if (key1ContainsCurlyBrace && !key2ContainsCurlyBrace) { + return 1; + } else { + return 0; + } + }; + + Collections.sort(list, comparator); + + HashMap sortedPaths = new LinkedHashMap<>(); + for (Map.Entry entry : list) { + sortedPaths.put(entry.getKey(), entry.getValue()); + } + + for (Map.Entry pathEntry : sortedPaths.entrySet()) { List builtPathPatterns = PathResolver.instance().buildPathPatterns( openApi.getContext(), openApi.getServers(), From 770762153a2559faea877bf0f3b31069f628f804 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Mon, 15 Apr 2024 18:00:59 -0400 Subject: [PATCH 05/17] temporarily update version name --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 022ec42..e3bcd27 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { apply plugin: 'jacoco' group = "org.openapi4j" - version = "1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") + version = "MS3-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") java { sourceCompatibility = JavaVersion.VERSION_1_8 From 15be53863ca95109f8996fbf373fdd45fce94f2e Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Tue, 16 Apr 2024 10:43:52 -0400 Subject: [PATCH 06/17] fix test comment --- .../operation/validator/validation/RequestValidatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java b/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java index 2ac39df..3e33430 100644 --- a/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java +++ b/openapi-operation-validator/src/test/java/org/openapi4j/operation/validator/validation/RequestValidatorTest.java @@ -133,7 +133,7 @@ public void withServerPathFindOperationCheck() throws Exception { } @Test - // Right now this test is a little flaky, there is a small chance that this will throw a false positive, due to the 'randomness' of how the pathPatterns are formed + // if Map patterns in RequestValidator.buildPathPatterns() is initialized as a map that doesn't retain order of elements then this test can produce unreliable results // Multiple resources on /greeting/{id} in yaml should reduce the chance public void withPathCollision() throws Exception { URL specPath = RequestValidatorTest.class.getResource("/request/pathCollision.yaml"); From 3cf1eadda83a45ce84bc73c69ab626b721b98ada Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Tue, 16 Apr 2024 14:20:39 -0400 Subject: [PATCH 07/17] experiment with publishing to github packages --- .github/.workflows/release.yaml | 26 +++++++++++++++++++++++++ publish.gradle | 34 ++++++++------------------------- 2 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 .github/.workflows/release.yaml diff --git a/.github/.workflows/release.yaml b/.github/.workflows/release.yaml new file mode 100644 index 0000000..3b006fe --- /dev/null +++ b/.github/.workflows/release.yaml @@ -0,0 +1,26 @@ +name: Publish package to the Maven Central Repository and GitHub Packages +on: + release: + types: [published] +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 + + - name: Publish package + run: ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/publish.gradle b/publish.gradle index 1d8b12c..08ec897 100644 --- a/publish.gradle +++ b/publish.gradle @@ -36,40 +36,22 @@ publishing { id = 'llfbandit' name = 'Rémy NOËL' } - } - scm { - connection = "scm:git:git://github.com:openapi4j/openapi4j.git" - developerConnection = "scm:git:ssh://@github.com:openapi4j/openapi4j.git" - url = "https://github.com/openapi4j/openapi4j" + developer { + id = 'rlratcliffe' + name = 'Rob Ratcliffe' + } } } } } repositories { - // Local publication to allow checks - /*maven { - def releasesUrl = uri("$buildDir/publish/release") - def snapshotsUrl = uri("$buildDir/publish/snapshot") - url version.endsWith("SNAPSHOT") ? snapshotsUrl : releasesUrl - }*/ maven { - name "ossrh" + name = "GitHubPackages" + url = "https://maven.pkg.github.com/rlratcliffe/openapi4j" credentials { - username findProperty("publishUsername") != null ? findProperty("publishUsername") : System.getenv("publishUsername") - password findProperty("publishPassword") != null ? findProperty("publishPassword") : System.getenv("publishPassword") + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") } - - def snapshotsUrl = "https://oss.sonatype.org/content/repositories/snapshots" - def releasesUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2" - url version.endsWith("SNAPSHOT") ? snapshotsUrl : releasesUrl } } } - -tasks.withType(Sign) { - onlyIf { !version.endsWith("SNAPSHOT") } -} - -signing { - sign publishing.publications.mavenJava -} From d34ef272d215354305c333257c2a130130c55658 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Tue, 16 Apr 2024 14:22:08 -0400 Subject: [PATCH 08/17] temporary update to version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e3bcd27..8cba809 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { apply plugin: 'jacoco' group = "org.openapi4j" - version = "MS3-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") + version = "RLR-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") java { sourceCompatibility = JavaVersion.VERSION_1_8 From ff42ce7fbe3232333b0c288f1bb191e586d76379 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Tue, 16 Apr 2024 14:26:30 -0400 Subject: [PATCH 09/17] fix github workflow directory naming --- .github/{.workflows => workflows}/release.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{.workflows => workflows}/release.yaml (100%) diff --git a/.github/.workflows/release.yaml b/.github/workflows/release.yaml similarity index 100% rename from .github/.workflows/release.yaml rename to .github/workflows/release.yaml From 4e18bb2ee881c32cbf58ba4068d91bb3dcd14bc4 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Tue, 16 Apr 2024 15:45:59 -0400 Subject: [PATCH 10/17] Revert "temporary update to version" This reverts commit d34ef272d215354305c333257c2a130130c55658. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8cba809..e3bcd27 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { apply plugin: 'jacoco' group = "org.openapi4j" - version = "RLR-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") + version = "MS3-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") java { sourceCompatibility = JavaVersion.VERSION_1_8 From 66966cd27ee899a5f5367e324ae4481cad96f21f Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 14:44:11 -0400 Subject: [PATCH 11/17] add jacoco back, make compatible with gradle 8.6 --- build.gradle | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build.gradle b/build.gradle index e3bcd27..ace5d1b 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,30 @@ allprojects { // Only report code coverage for published projects def publishedProjects = subprojects.findAll { it.path != ':openapi-perf-checker' } +tasks.register("jacocoMerge", JacocoReport) { + dependsOn { + publishedProjects.collect { it.tasks.withType(Test) } + } + doFirst { + executionData = files(executionData.files.findAll { it.exists() }) + } +} + +tasks.register("codeCoverageReport", JacocoReport) { + dependsOn(publishedProjects.collect { it.tasks.named("test") }, "jacocoMerge") + + additionalSourceDirs.from(publishedProjects.sourceSets.main.allSource.srcDirs) + sourceDirectories.from(publishedProjects.sourceSets.main.allSource.srcDirs) + classDirectories.from(publishedProjects.sourceSets.main.output) + executionData(jacocoMerge.get().destinationFile) + + reports { + xml.enabled(true) + html.enabled(true) + csv.enabled(false) + } +} + sonarqube { properties { property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/codeCoverageReport/codeCoverageReport.xml" From 143ce5d8b98bdde3a99efcb0323f860ccc58d7ba Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 14:44:28 -0400 Subject: [PATCH 12/17] clean up --- .github/workflows/release.yaml | 2 +- .../validator/validation/RequestValidator.java | 11 +++++------ publish.gradle | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3b006fe..3072c75 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Publish package to the Maven Central Repository and GitHub Packages +name: Publish package to GitHub Packages on: release: types: [published] diff --git a/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java b/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java index ad9c474..568702b 100644 --- a/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java +++ b/openapi-operation-validator/src/main/java/org/openapi4j/operation/validator/validation/RequestValidator.java @@ -315,11 +315,10 @@ private void validateResponse(final Response response, private Map buildPathPatterns() { Map patterns = new LinkedHashMap<>(); - Map paths = openApi.getPaths(); + Map originalPaths = openApi.getPaths(); + List > originalPathsAsList = new LinkedList<>(originalPaths.entrySet()); - List > list = new LinkedList<>(paths.entrySet()); - - Comparator> comparator = (entry1, entry2) -> { + Comparator> pathComparator = (entry1, entry2) -> { boolean key1ContainsCurlyBrace = entry1.getKey().contains("{"); boolean key2ContainsCurlyBrace = entry2.getKey().contains("{"); @@ -332,10 +331,10 @@ private Map buildPathPatterns() { } }; - Collections.sort(list, comparator); + Collections.sort(originalPathsAsList, pathComparator); HashMap sortedPaths = new LinkedHashMap<>(); - for (Map.Entry entry : list) { + for (Map.Entry entry : originalPathsAsList) { sortedPaths.put(entry.getKey(), entry.getValue()); } diff --git a/publish.gradle b/publish.gradle index 08ec897..ced6ee9 100644 --- a/publish.gradle +++ b/publish.gradle @@ -47,7 +47,7 @@ publishing { repositories { maven { name = "GitHubPackages" - url = "https://maven.pkg.github.com/rlratcliffe/openapi4j" + url = "https://maven.pkg.github.com/ms3inc/openapi4j" credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") From 632263702158f5c6268824acaa8eecc45a5b60a6 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 14:46:27 -0400 Subject: [PATCH 13/17] cleanup workflow --- .github/workflows/{release.yaml => github-publish.yaml} | 2 -- 1 file changed, 2 deletions(-) rename .github/workflows/{release.yaml => github-publish.yaml} (84%) diff --git a/.github/workflows/release.yaml b/.github/workflows/github-publish.yaml similarity index 84% rename from .github/workflows/release.yaml rename to .github/workflows/github-publish.yaml index 3072c75..02320c2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/github-publish.yaml @@ -21,6 +21,4 @@ jobs: - name: Publish package run: ./gradlew publish env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ccf578bb0ab565f10a52b4283612ed1e6db244e3 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 15:11:40 -0400 Subject: [PATCH 14/17] use github publish to only publish releases instead of snapshots --- .github/workflows/github-publish.yaml | 2 ++ build.gradle | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-publish.yaml b/.github/workflows/github-publish.yaml index 02320c2..c33b3ac 100644 --- a/.github/workflows/github-publish.yaml +++ b/.github/workflows/github-publish.yaml @@ -2,6 +2,7 @@ name: Publish package to GitHub Packages on: release: types: [published] + jobs: publish: runs-on: ubuntu-latest @@ -22,3 +23,4 @@ jobs: run: ./gradlew publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE: true diff --git a/build.gradle b/build.gradle index ace5d1b..d1e476e 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { apply plugin: 'jacoco' group = "org.openapi4j" - version = "MS3-1.0.7" + (Boolean.valueOf(System.getProperty("release")) ? "" : "-SNAPSHOT") + version = "MS3-1.0.7" + (Boolean.valueOf(System.getenv("RELEASE")) ? "" : "-SNAPSHOT") java { sourceCompatibility = JavaVersion.VERSION_1_8 From c0790c7af79d25fa193de1e693aa6a85197d61d5 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 15:16:41 -0400 Subject: [PATCH 15/17] temp change to rlratcliffe to test package creation --- publish.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.gradle b/publish.gradle index ced6ee9..08ec897 100644 --- a/publish.gradle +++ b/publish.gradle @@ -47,7 +47,7 @@ publishing { repositories { maven { name = "GitHubPackages" - url = "https://maven.pkg.github.com/ms3inc/openapi4j" + url = "https://maven.pkg.github.com/rlratcliffe/openapi4j" credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") From 697b07388b998cd7d0011c57261b2899a4d1e30e Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 15:23:11 -0400 Subject: [PATCH 16/17] Revert "temp change to rlratcliffe to test package creation" This reverts commit c0790c7af79d25fa193de1e693aa6a85197d61d5. --- publish.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.gradle b/publish.gradle index 08ec897..ced6ee9 100644 --- a/publish.gradle +++ b/publish.gradle @@ -47,7 +47,7 @@ publishing { repositories { maven { name = "GitHubPackages" - url = "https://maven.pkg.github.com/rlratcliffe/openapi4j" + url = "https://maven.pkg.github.com/ms3inc/openapi4j" credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") From 624a49bf25922824bbcb42b5e5500131b0020282 Mon Sep 17 00:00:00 2001 From: Rob Ratcliffe Date: Thu, 18 Apr 2024 15:25:17 -0400 Subject: [PATCH 17/17] bump version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d1e476e..e18d28f 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ allprojects { apply plugin: 'jacoco' group = "org.openapi4j" - version = "MS3-1.0.7" + (Boolean.valueOf(System.getenv("RELEASE")) ? "" : "-SNAPSHOT") + version = "MS3-1.0.8" + (Boolean.valueOf(System.getenv("RELEASE")) ? "" : "-SNAPSHOT") java { sourceCompatibility = JavaVersion.VERSION_1_8