-
Notifications
You must be signed in to change notification settings - Fork 6
171 lines (150 loc) · 7.44 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
name: CI
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-18.04
outputs:
version: ${{ steps.create_tag.outputs.versionNumber || steps.create_tag.outputs.version || steps.create_tag.outputs.preversion }}
steps:
- uses: actions/checkout@master
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14
# - run: npm install
# - run: npm run hoist
- run: yarn
- run: yarn run build
# - run: npm run build
- run: mkdir -p build
- name: Converts @kkt/ssr Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
output: build/index.html
github-corners: https://github.com/kktjs/ssr.git
- name: Converts create-kkt-ssr Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
output: build/create-kkt-ssr.html
github-corners: https://github.com/kktjs/ssr/tree/master/packages/create-kkt-ssr
- 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: Create Tag
id: create_tag
uses: jaywcjlove/[email protected]
with:
package-path: ./core/package.json
- name: get tag version
id: tag_version
uses: jaywcjlove/[email protected]
# 批量生成压缩包 并保存指定文件目录中
- run: npm run build:js
- run: npm run test
- run: npm run build:zip
- name: Add Download Page
working-directory: ./build/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> '
VERSION_NUMBER=$(echo "${{ steps.create_tag.outputs.versionNumber || steps.create_tag.outputs.version || steps.create_tag.outputs.preversion }}")
GITHUBREADME='https://github.com/kktjs/ssr/tree/master/example/'
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-ssr 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-ssr 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><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/ssr">GitHub</a> ·
<a target="__blank" href="https://github.com/kktjs/ssr/issues">Feedback</a> ·
<a target="__blank" href="https://github.com/kktjs/ssr">Create SSR Project</a> ·
<a target="__blank" href="https://github.com/kktjs/ssr">kkt-ssr</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: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
- name: Generate Changelog
id: changelog
uses: jaywcjlove/[email protected]
if: steps.create_tag.outputs.successful
with:
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.create_tag.outputs.version }}
tag: ${{ steps.create_tag.outputs.version }}
body: |
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/kktjs/ssr/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
- name: 📦 @kkt/ssr publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./core/package.json
- name: 📦 create-kkt-ssr publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/create-kkt-ssr/package.json
- name: 📦 @kkt/react-ssr-enhanced publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-ssr-enhanced/package.json
- name: 📦 @kkt/plugin-less publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/kkt-plugin-less/package.json