diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 00000000..6b78b001 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,42 @@ +name: Publish HMPPS Integration API Documentation + +on: + workflow_dispatch: + push: + +jobs: + build: + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + bundler-cache: true + working-directory: tech-docs + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - uses: gradle/actions/setup-gradle@v4 + - name: Serve dependencies + run: make serve-dependencies + - name: Start service + run: | + ./gradlew bootRun & + timeout 300 sh -c 'until curl -s localhost:8080/v3/api-docs; do sleep 5; done' + env: + SPRING_PROFILES_ACTIVE: local + - name: Fetch API docs + run: mkdir -p openapi && curl -f localhost:8080/v3/api-docs -o openapi/api-docs.json + - name: Build + run: | + gem install middleman + bundle exec middleman build --verbose + working-directory: tech-docs + - name: Bundle OpenAPI specs + run: | + curl -sf localhost:8080/v3/api-docs -o api-docs.json + working-directory: tech-docs/build + - uses: actions/upload-artifact@v4 + with: + path: tech-docs/build