diff --git a/.github/workflows/swagger.yml b/.github/workflows/swagger.yml index 2952c5b1..4ed4f577 100644 --- a/.github/workflows/swagger.yml +++ b/.github/workflows/swagger.yml @@ -25,12 +25,7 @@ jobs: - name: Generate Swagger documentation run: ./gradlew generateOpenApiDocs - - name: Get version number - id: versionNumber - run: echo "::set-output name=versionNumber::$(./gradlew printVersion --quiet | tail -1)" - - name: Upload Swagger Documentation to SwaggerHub - run: | - curl -X POST -H "Authorization: ${SWAGGERHUB_API_KEY}" -H "Content-Type: application/json" -d @./SwaggerDoc.json "https://api.swaggerhub.com/apis/Frooodle/Stirling-PDF/${{ steps.versionNumber.outputs.versionNumber }}?isPrivate=false&force=true" + run: ./gradlew swaggerhubUpload env: SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }} diff --git a/build.gradle b/build.gradle index 478ee5b4..5e77d666 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'org.springframework.boot' version '3.1.0' id 'io.spring.dependency-management' version '1.1.0' id 'org.springdoc.openapi-gradle-plugin' version '1.6.0' + id "io.swagger.swaggerhub" version "1.1.0" } group = 'stirling.software' @@ -48,11 +49,18 @@ task writeVersion { props.store(propsFile.newWriter(), null) } -tasks.matching { it.name == 'generateOpenApiDocs' }.all { - dependsOn writeVersion +swaggerhubUpload { + //dependsOn generateOpenApiDocs // Depends on your task generating Swagger docs + api 'Stirling-PDF' // The name of your API on SwaggerHub + owner 'Frooodle' // Your SwaggerHub username (or organization name) + version project.version // The version of your API + inputFile './SwaggerDoc.json' // The path to your Swagger docs + token "${System.getenv('SWAGGERHUB_API_KEY')}" // Your SwaggerHub API key, passed as an environment variable + oas '3.0.0' // The version of the OpenAPI Specification you're using } + jar { enabled = false manifest {