generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (84 loc) · 2.55 KB
/
publish-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 }}