-
Notifications
You must be signed in to change notification settings - Fork 1
172 lines (143 loc) Β· 5.08 KB
/
main.yml
File metadata and controls
172 lines (143 loc) Β· 5.08 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write # Required for gh-pages deployment
jobs:
# ============================================================================
# Job 1: Quality Assurance (CI)
# Runs on multiple Node.js versions for compatibility testing
# ============================================================================
ci:
name: CI (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x]
steps:
# 1. Checkout code
- name: Checkout code
uses: actions/checkout@v4
# 2. Setup Node.js
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# 3. Install dependencies
- name: Install dependencies
run: npm ci
# 4. Code quality checks
- name: Run linting
run: npm run lint
- name: Run type checking
run: npm run type-check
# 5. Documentation validation
- name: Validate documentation links
run: npm run validate:links
- name: Validate documentation examples
run: npm run validate:examples
# 6. Testing
- name: Run tests
run: npm test
- name: Generate coverage report
run: npm run test:coverage
# 7. Build validation
- name: Build project
run: npm run build
- name: Validate build artifacts
run: |
test -d dist || exit 1
test -f dist/esm/index.js || exit 1
test -f dist/cjs/index.cjs || exit 1
test -f dist/esm/index.d.ts || exit 1
echo "β Build artifacts validated successfully"
# 8. Coverage upload (Node 20.x only)
- name: Upload coverage to Codecov
if: matrix.node-version == '20.x'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
# 9. Generate API documentation (Node 20.x only)
- name: Generate API documentation
if: matrix.node-version == '20.x'
run: npm run docs:api
- name: Validate API documentation
if: matrix.node-version == '20.x'
run: |
test -d docs/api || exit 1
test -f docs/api/modules.md || exit 1
test -d docs/api/classes || exit 1
test -d docs/api/interfaces || exit 1
echo "β API documentation (Markdown) validated successfully"
# 10. Upload API docs artifact for deployment job
- name: Upload API docs artifact
if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v4
with:
name: api-docs
path: docs/api/
retention-days: 30
# ============================================================================
# Job 2: Documentation Deployment
# Depends on successful CI, deploys only on main branch
# ============================================================================
deploy:
name: Deploy Documentation
needs: ci # Wait for CI to complete successfully
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
# 1. Checkout code
- name: Checkout code
uses: actions/checkout@v4
# 2. Setup Node.js
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
# 3. Install dependencies
- name: Install dependencies
run: npm ci
# 4. Download API docs from CI job
- name: Download API docs artifact
uses: actions/download-artifact@v4
with:
name: api-docs
path: docs/api/
# 5. Build VitePress documentation
- name: Build VitePress documentation
env:
NODE_ENV: production
run: npm run docs:build
- name: Validate documentation output
run: |
test -d docs/.vitepress/dist || exit 1
test -f docs/.vitepress/dist/index.html || exit 1
echo "β Documentation build validated successfully"
# 6. Extract version for commit message
- name: Extract SDK version
id: version
run: echo "SDK_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
# 7. Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/.vitepress/dist
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'docs: deploy v${{ env.SDK_VERSION }} - ${{ github.sha }}'
enable_jekyll: false
# 8. Deployment confirmation
- name: Deployment complete
run: |
echo "β Documentation deployed successfully!"
echo "π Visit: https://salacoste.github.io/daytona-wildberries-typescript-sdk/"
echo "π¦ Version: v${{ env.SDK_VERSION }}"
echo "π Commit: ${{ github.sha }}"