-
-
Notifications
You must be signed in to change notification settings - Fork 11
459 lines (384 loc) · 18.6 KB
/
ci.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
name: Build KKT & Example
on:
push:
branches:
- master
env:
# SKIP_PREFLIGHT_CHECK: true
CI: false
jobs:
windows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Look Changelog
uses: jaywcjlove/changelog-generator@main
with:
filter-author: (小弟调调™|Renovate Bot|renovate-bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
- run: npm install
- run: npm run build
- run: npm install
- name: kkt core
working-directory: core
run: npm run build
- name: example @template/basic
working-directory: example/basic
run: npm run build && npm run coverage
- name: example @template/basic-entry
working-directory: example/basic-entry
run: npm run build
- name: example @template/chrome-plugin
working-directory: example/chrome-plugin
run: npm run build && npm run coverage
- name: example @template/electron
run: npm run build && npm run build:main
working-directory: example/electron
- name: example @template/less
working-directory: example/less
run: npm run build
- name: example @template/markdown
working-directory: example/markdown
run: npm run build
- name: example @template/react-component-tsx
working-directory: example/react-component-tsx
run: |
npm run build
npm run doc
npm run coverage
# The following changes are being made to your tsconfig.json file:
# - compilerOptions.noEmit must be true
git checkout -f ./tsconfig.json
- name: example @template/react-router
working-directory: example/react-router
run: npm run build
- name: example @template/react-router-ts
working-directory: example/react-router-ts
run: npm run build
- name: example @template/scss
working-directory: example/scss
run: npm run build
- name: example @template/stylus
working-directory: example/stylus
run: npm run build
- name: example @template/typescript
working-directory: example/typescript
run: npm run build && npm run coverage
- name: example @template/uiw
working-directory: example/uiw
run: npm run build
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- run: npm install
- name: kkt core
working-directory: core
run: npm run build
- run: mkdir -p build
- name: Converts ncc Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
github-corners: https://github.com/kktjs/ncc
source: packages/ncc/README.md
output: build/ncc.html
- name: Create idoc config.
working-directory: core
run: |
cat > idoc.yml << EOF
site: "KKT {{version}}"
menus:
KKT: index.html
NCC: https://kktjs.github.io/ncc/
Create-KKT: https://kktjs.github.io/create-kkt/
Zip: https://kktjs.github.io/zip/
EOF
- run: npm install idoc@1 -g
- run: idoc
working-directory: core
- run: cp -rp core/dist/* ./build
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: build/CONTRIBUTORS.svg
avatarSize: 42
- name: example @template/basic
working-directory: example/basic
run: npm run build && npm run coverage
- name: example @template/basic-entry
working-directory: example/basic-entry
run: npm run build
- name: example @template/chrome-plugin
working-directory: example/chrome-plugin
run: npm run build && npm run coverage
- name: example @template/electron
run: npm run build && npm run build:main
working-directory: example/electron
- name: example @template/less
working-directory: example/less
run: npm run build
- name: example @template/markdown
working-directory: example/markdown
run: npm run build
- name: example @template/react-component-tsx
working-directory: example/react-component-tsx
run: |
npm run build
npm run doc
npm run coverage
# The following changes are being made to your tsconfig.json file:
# - compilerOptions.noEmit must be true
git checkout -f ./tsconfig.json
- name: example @template/react-router
working-directory: example/react-router
run: npm run build
- name: example @template/react-router-ts
working-directory: example/react-router-ts
run: npm run build
- name: example @template/scss
working-directory: example/scss
run: npm run build
- name: example @template/stylus
working-directory: example/stylus
run: npm run build
- name: example @template/typescript
working-directory: example/typescript
run: npm run build && npm run coverage
- name: example @template/uiw
working-directory: example/uiw
run: npm run build
- run: mkdir -p zip
- name: Compress basic Example.
run: zip -r -y basic.zip . -x "node_modules/*" -x "build/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/basic
- run: cp -rp example/basic/basic.zip ./zip
- name: Compress basic-entry Example.
run: zip -r -y basic-entry.zip . -x "node_modules/*" -x "build/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/basic-entry
- run: cp -rp example/basic-entry/basic-entry.zip ./zip
- name: Compress chrome-plugin Example.
run: zip -r -y chrome-plugin.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/chrome-plugin
- run: cp -rp example/chrome-plugin/chrome-plugin.zip ./zip
- name: Compress electron Example.
run: zip -r -y electron.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/electron
- run: cp -rp example/electron/electron.zip ./zip
- name: Compress less Example.
run: zip -r -y less.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/less
- run: cp -rp example/less/less.zip ./zip
- name: Compress less Example.
run: zip -r -y less.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/less
- run: cp -rp example/less/less.zip ./zip
- name: Compress markdown Example.
run: zip -r -y markdown.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/markdown
- run: cp -rp example/markdown/markdown.zip ./zip
- name: Compress react-component-tsx Example.
run: zip -r -y react-component-tsx.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "lib/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/react-component-tsx
- run: cp -rp example/react-component-tsx/react-component-tsx.zip ./zip
- name: Compress react-router Example.
run: zip -r -y react-router.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/react-router
- run: cp -rp example/react-router/react-router.zip ./zip
- name: Compress react-router-ts Example.
run: zip -r -y react-router-ts.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/react-router-ts
- run: cp -rp example/react-router-ts/react-router-ts.zip ./zip
- name: Compress scss Example.
run: zip -r -y scss.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/scss
- run: cp -rp example/scss/scss.zip ./zip
- name: Compress stylus Example.
run: zip -r -y stylus.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/stylus
- run: cp -rp example/stylus/stylus.zip ./zip
- name: Compress typescript Example.
run: zip -r -y typescript.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/typescript
- run: cp -rp example/typescript/typescript.zip ./zip
- name: Compress uiw Example.
run: zip -r -y uiw.zip . -x "node_modules/*" -x "build/*" -x "dist/*" -x "coverage/*" -x ".eslintcache" -x "sandbox.config.json"
working-directory: example/uiw
- run: cp -rp example/uiw/uiw.zip ./zip
- name: get tag version
id: tag_version
uses: jaywcjlove/changelog-generator@main
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
- name: Is a tag created auto?
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
package-path: ./core/package.json
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
if: steps.create_tag.outputs.successful
with:
head-ref: ${{ steps.create_tag.outputs.version }}
filter-author: (小弟调调™|Renovate Bot|renovate-bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
- name: Create Release
uses: ncipollo/release-action@v1
if: steps.create_tag.outputs.successful
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.changelog.outputs.tag }}
tag: ${{ steps.changelog.outputs.tag }}
body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/kkt@${{steps.changelog.outputs.version}}/file/README.md) [![npm version](https://img.shields.io/npm/v/kkt.svg)](https://www.npmjs.com/package/kkt)
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/kktjs/kkt/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
```bash
npm i kkt@${{steps.changelog.outputs.version}}
```
${{ steps.changelog.outputs.changelog }}
- run: git status
- name: 📦 kkt publish to NPM
run: npm publish --access public --provenance
working-directory: core
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/less-modules publish to NPM
run: npm publish --access public --provenance
working-directory: packages/less-modules
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/raw-modules publish to NPM
run: npm publish --access public --provenance
working-directory: packages/raw-modules
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/react-library publish to NPM
run: npm publish --access public --provenance
working-directory: packages/react-library
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/scope-plugin-options publish to NPM
run: npm publish --access public --provenance
working-directory: packages/scope-plugin-options
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/stylus-modules publish to NPM
run: npm publish --access public --provenance
working-directory: packages/stylus-modules
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: 📦 @kkt/resolve-fallback publish to NPM
run: npm publish --access public --provenance
working-directory: packages/resolve-fallback
continue-on-error: true
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
- name: Compress uiw Example.
working-directory: zip
run: |
ICON='<svg viewBox="0 0 1024 1024" width="14" height="14"><path d="M192 384h640a42.666667 42.666667 0 0 1 42.666667 42.666667v362.666666a42.666667 42.666667 0 0 1-42.666667 42.666667H192v106.666667a21.333333 21.333333 0 0 0 21.333333 21.333333h725.333334a21.333333 21.333333 0 0 0 21.333333-21.333333V308.821333L949.909333 298.666667h-126.528A98.048 98.048 0 0 1 725.333333 200.618667V72.661333L716.714667 64H213.333333a21.333333 21.333333 0 0 0-21.333333 21.333333v298.666667zM128 832H42.666667a42.666667 42.666667 0 0 1-42.666667-42.666667V426.666667a42.666667 42.666667 0 0 1 42.666667-42.666667h85.333333V85.333333a85.333333 85.333333 0 0 1 85.333333-85.333333h530.026667L1024 282.453333V938.666667a85.333333 85.333333 0 0 1-85.333333 85.333333H213.333333a85.333333 85.333333 0 0 1-85.333333-85.333333v-106.666667z m32.661333-359.509333v38.4h147.072l-158.592 200.448V746.666667h226.176v-38.4H207.893333l158.208-200.064v-35.712h-205.44z m251.136 0V746.666667h44.928V472.490667h-44.928z m98.688 0V746.666667h44.928v-105.216h67.968c66.816 0 100.224-28.416 100.224-84.864 0-56.064-33.408-84.096-99.456-84.096h-113.664z m44.928 38.4h65.28c19.584 0 34.176 3.456 43.392 10.752 9.216 6.912 14.208 18.432 14.208 34.944 0 16.512-4.608 28.416-13.824 35.712-9.216 6.912-23.808 10.752-43.776 10.752h-65.28v-92.16z" fill="currentColor"></path></svg> '
CodeSandbox='https://codesandbox.io/s/github/kktjs/kkt/tree/master/example/'
GITHUBREADME='https://github.com/kktjs/kkt/tree/master/example/'
VERSION_NUMBER=$(echo "${{ steps.create_tag.outputs.versionNumber || steps.create_tag.outputs.version || steps.create_tag.outputs.preversion }}")
cat > index.html << EOF
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="https://github.githubassets.com/favicon.ico">
<title>KKT Example Zip Files</title>
<style type="text/css">
body, html { height: 100%; font-size: 12px; font-family: Avenir Next,PingFang SC,Hiragino Sans GB,Droid Sans Fallback,Microsoft YaHei,sans-serif; }
h1 { font-size: 2.6rem; font-weight: 300; }
h1 sup { color: #7b7b7b; font-size: 14px; position: absolute; font-weight: normal;}
a:hover { color: #0949d1; }
.header { position: relative; width: 100%; height: 60%; text-align: center; }
.list { border-spacing: 0; border-collapse: collapse; margin: 0 auto 0 auto;}
.list td { padding: 3px 10px; line-height: 21px; }
.list td svg { display: block; }
.list tr:hover { background-color: #f1f1f1; }
.links { text-align: center; padding: 50px 0 0 0; font-size: 14px; }
.footer { color: #696969; text-align: center; padding: 10px 0 90px 0; }
.footer a { padding: 10px 0 90px 0; color: #696969 }
</style>
</head>
<body>
<table class="header"> <tbody> <tr> <td>
<h1>KKT Example Zip Files<sup>v$VERSION_NUMBER</sup></h1>
</td> </tr> </tbody> </table>
<table class="list">
<tbody>
$(for file in $(ls *.zip); do
echo "<tr>"
echo "<td>${ICON}</td>"
echo "<td><a href=\"${file}\">$file</a></td>"
echo "<td>"
if [[ "$file" != "electron.zip" && "$file" != "chrome-plugin.zip" ]]; then
echo "<a target=\"__blank\" href=\"$CodeSandbox${file//.zip/}\">Open in CodeSandbox</a>"
else
echo ' -'
fi;
echo "</td>"
echo "<td><a target=\"__blank\" href=\"$GITHUBREADME${file//.zip/}\">Document</a></td>"
echo "</tr>"
done)
</tbody>
</table>
<div class="links">
<a target="__blank" href="https://github.com/kktjs/kkt">GitHub</a> ·
<a target="__blank" href="https://github.com/kktjs/kkt/issues">Feedback</a> ·
<a target="__blank" href="https://github.com/kktjs/create-kkt">Create KKT Project</a> ·
<a target="__blank" href="https://github.com/kktjs/kkt-ssr">KKT SSR</a> ·
<a target="__blank" href="https://github.com/kktjs/kkt/tree/master/packages/nccr">NCC</a>
</div>
<div class="footer">
Licensed under MIT. (Yes it's free and open-sourced)
<div>
Created By <a target="__blank" href="https://github.com/jaywcjlove">小弟调调™</a>
</div>
</div>
</body></html>
EOF
- name: Upload *.zip Files
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
personal_token: ${{ secrets.PERSONAL_TOKEN_KKT }}
external_repository: kktjs/zip
force_orphan: true
publish_branch: gh-pages
publish_dir: ./zip
- name: Upload *.zip Files
uses: peaceiris/actions-gh-pages@v4
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
personal_token: ${{ secrets.PERSONAL_TOKEN_KKT }}
external_repository: kktjs/zip
force_orphan: true
publish_branch: v${{ steps.create_tag.outputs.majorVersion }}
publish_dir: ./zip