2023-06-03 23:56:15 +02:00
|
|
|
name: Update Swagger
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-03-22 21:15:42 +01:00
|
|
|
|
2023-06-03 23:56:15 +02:00
|
|
|
jobs:
|
|
|
|
push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-12-21 13:28:35 +01:00
|
|
|
- name: Harden Runner
|
|
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
|
|
with:
|
|
|
|
egress-policy: audit
|
|
|
|
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-06-03 23:56:15 +02:00
|
|
|
|
2024-04-21 17:30:17 +02:00
|
|
|
- name: Set up JDK 17
|
2024-12-21 13:28:35 +01:00
|
|
|
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
|
2024-04-21 17:30:17 +02:00
|
|
|
with:
|
|
|
|
java-version: "17"
|
|
|
|
distribution: "temurin"
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-12-21 13:28:35 +01:00
|
|
|
- uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2024-04-21 17:30:17 +02:00
|
|
|
- name: Generate Swagger documentation
|
|
|
|
run: ./gradlew generateOpenApiDocs
|
2023-06-03 23:56:15 +02:00
|
|
|
|
2024-04-21 17:30:17 +02:00
|
|
|
- name: Upload Swagger Documentation to SwaggerHub
|
|
|
|
run: ./gradlew swaggerhubUpload
|
|
|
|
env:
|
|
|
|
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
|
2023-06-03 23:56:15 +02:00
|
|
|
|
2024-04-21 17:30:17 +02:00
|
|
|
- name: Get version number
|
|
|
|
id: versionNumber
|
|
|
|
run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT
|
2023-06-04 00:32:47 +02:00
|
|
|
|
2024-04-21 17:30:17 +02:00
|
|
|
- name: Set API version as published and default on SwaggerHub
|
|
|
|
run: |
|
|
|
|
curl -X PUT -H "Authorization: ${SWAGGERHUB_API_KEY}" "https://api.swaggerhub.com/apis/Frooodle/Stirling-PDF/${{ steps.versionNumber.outputs.versionNumber }}/settings/lifecycle" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"published\":true,\"default\":true}"
|
|
|
|
env:
|
|
|
|
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
|