-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (98 loc) · 2.77 KB
/
api-docs.yml
File metadata and controls
115 lines (98 loc) · 2.77 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: API Documentation
on:
push:
branches: [ main, develop ]
paths:
- 'docs/**'
- '.github/workflows/api-docs.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'docs/**'
- '.github/workflows/api-docs.yml'
workflow_dispatch:
jobs:
validate:
name: Validate OpenAPI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24.15.0'
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
working-directory: ./docs
run: npm ci
env:
HUSKY: '0'
- name: Build OpenAPI spec
working-directory: ./docs
run: npm run build
- name: Validate OpenAPI spec
working-directory: ./docs
run: npm run validate
- name: Run tests
working-directory: ./docs
run: npm test
- name: Upload coverage report
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-report
path: ./docs/coverage
retention-days: 5
deploy:
name: Deploy Documentation
needs: validate
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24.15.0'
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
working-directory: ./docs
run: npm ci
env:
HUSKY: '0'
- name: Build OpenAPI spec
working-directory: ./docs
run: npm run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.redocly
keep_files: true
force_orphan: true
enable_jekyll: false
user_name: 'GitHub Action'
user_email: 'action@github.com'
commit_message: 'Deploy API documentation'
notify:
name: Notify on Failure
if: failure()
needs: [validate, deploy]
runs-on: ubuntu-latest
steps:
- name: Send notification
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: '#FF0000'
SLACK_TITLE: 'API Documentation Build Failed'
SLACK_MESSAGE: 'Build failed in ${{ github.workflow }}. Check the logs for details.'
SLACK_USERNAME: 'GitHub Actions'
SLACK_ICON: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'