-
Notifications
You must be signed in to change notification settings - Fork 496
221 lines (188 loc) · 6.51 KB
/
tlroadmap_site.yaml
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
name: Publish site
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-vuepress:
name: Build VuePress site and generate roadmap tree
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install js dependencies
run: yarn install --frozen-lockfile
- name: Build vuepress site
run: yarn run site:build
- name: Upload pre-site to artifact
uses: actions/upload-artifact@v1
with:
name: vuepress-pre-site
path: tlroadmap/.vuepress/dist
- name: Upload trees
uses: actions/upload-artifact@v1
with:
name: trees
path: tlroadmap/.vuepress/trees
generate-roadmap-freemind-plantuml:
name: Generate .mm and .puml
runs-on: ubuntu-latest
needs:
- build-vuepress
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: trees
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tools/requirements.txt
- name: Run plantuml2freemind
run: |
mkdir freemind
mkdir plantuml
plantuml2freemind convert trees/tree-ru.json freemind/roadmap-ru.mm --no-interaction
plantuml2freemind convert trees/tree-ru.json plantuml/roadmap-ru.puml --no-interaction
cp plantuml/roadmap-ru.puml plantuml/roadmap-ru-dark-theme.puml
sed -i '2 i skinparam monochrome reverse' plantuml/roadmap-ru-dark-theme.puml
sed -i '3 i skinparam backgroundColor transparent' plantuml/roadmap-ru-dark-theme.puml
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: freemind
path: freemind
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: plantuml
path: plantuml
generate-roadmap-image:
name: Generate .svg and .png
runs-on: ubuntu-latest
needs:
- generate-roadmap-freemind-plantuml
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: plantuml
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Generate .png and .svg
run: |
mkdir images
cat plantuml/roadmap-ru.puml | java -jar tools/plantuml.jar -charset UTF-8 -pipe > images/roadmap-ru.png
cat plantuml/roadmap-ru.puml | java -jar tools/plantuml.jar -charset UTF-8 -tsvg -pipe > images/roadmap-ru.svg
cat plantuml/roadmap-ru-dark-theme.puml | java -jar tools/plantuml.jar -charset UTF-8 -tsvg -pipe > images/roadmap-ru-dark-theme.svg
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: images
path: images
combine-site:
name: Combine artifacts and site
runs-on: ubuntu-latest
needs:
- generate-roadmap-freemind-plantuml
- generate-roadmap-image
- build-vuepress
steps:
- uses: actions/download-artifact@v1
with:
name: vuepress-pre-site
- uses: actions/download-artifact@v1
with:
name: trees
- uses: actions/download-artifact@v1
with:
name: plantuml
- uses: actions/download-artifact@v1
with:
name: freemind
- uses: actions/download-artifact@v1
with:
name: images
- run: |
mv -v plantuml/* vuepress-pre-site
mv -v freemind/* vuepress-pre-site
mv -v images/* vuepress-pre-site
mv -v trees/* vuepress-pre-site
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: vuepress-site
path: vuepress-pre-site
publish-vuepress:
name: Publish VuePress site
runs-on: ubuntu-latest
needs:
- combine-site
steps:
- uses: actions/download-artifact@v1
with:
name: vuepress-site
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '16'
- name: Publish to netlify [prod]
id: publish-prod
if: github.ref == 'refs/heads/master'
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# If auto-publishing is on then right after deploying site address
# will be changed to main address:
# preview-abcde--subdomain.example.com -> subdomain.example.com
# Unfortunately, netlify-cms returns draft address :(
run: |
draft_url=$(npx -q netlify-cli deploy --json --dir=vuepress-site --prod | jq -r .deploy_url)
deploy_host=$(echo $draft_url | awk -F'--' '{print $NF}')
echo "::set-output name=deploy-url::https://$deploy_host"
- name: Publish to surge [preview]
id: publish-preview
if: github.event_name == 'pull_request'
env:
SURGE_LOGIN: [email protected]
SURGE_TOKEN: 843842568300f2462f3889cdc4692e8d
run: |
pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
deploy_host="${pr_number}-tlroadmap-review.surge.sh"
npx surge vuepress-site $deploy_host
echo "::set-output name=deploy-url::https://$deploy_host"
- name: Create GitHub deployment
uses: chrnorm/[email protected]
if: github.ref == 'refs/heads/master'
with:
token: "${{ github.token }}"
environment: "${{ (github.event_name == 'pull_request' && 'review') || 'prod' }}"
ref: "${{ github.head_ref || 'master' }}"
target_url: "${{ steps.publish-preview.outputs.deploy-url || steps.publish-prod.outputs.deploy-url }}"
initial_status: success