This commit is contained in:
Anthony Stirling 2023-06-03 23:21:12 +01:00
parent 48b3dea256
commit cefcda9f40
2 changed files with 11 additions and 8 deletions

View file

@ -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 }}

View file

@ -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 {