Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish HMPPS Integration API Documentation | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
deploy-openapi: | |
if: github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Bundle OpenAPI specs | |
run: | | |
mkdir openapi | |
curl -sf localhost:8080/v3/api-docs -o openapi/api-docs.json | |
working-directory: . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: openapi | |
path: openapi/ | |
- name: Deploy OpenAPI | |
uses: JamesIves/github-pages-deploy-action@62fec3add6773ec5dbbf18d2ee4260911aa35cf4 # v4.6.9 | |
with: | |
folder: openapi | |
target-folder: openapi | |
build-docs: | |
if: github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
needs: | |
- deploy-openapi | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
bundler-cache: true | |
working-directory: tech-docs | |
- name: Build Docs | |
run: | | |
gem install middleman | |
bundle exec middleman build --verbose | |
working-directory: tech-docs | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: documentation | |
path: tech-docs/build/ | |
deploy-docs: | |
if: github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
needs: | |
- build-docs | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: documentation | |
path: tech-docs-build | |
- uses: actions/download-artifact@v4 | |
with: | |
name: openapi | |
path: tech-docs-build/openapi/ | |
- name: Deploy | |
if: github.ref_name == 'main' | |
uses: JamesIves/github-pages-deploy-action@62fec3add6773ec5dbbf18d2ee4260911aa35cf4 # v4.6.9 | |
with: | |
folder: tech-docs-build | |
- name: Deploy branch | |
if: github.ref_name != 'main' | |
uses: JamesIves/github-pages-deploy-action@62fec3add6773ec5dbbf18d2ee4260911aa35cf4 # v4.6.9 | |
with: | |
folder: tech-docs-build | |
target-folder: drafts/${{ github.ref_name }} |