-
Notifications
You must be signed in to change notification settings - Fork 2
402 lines (342 loc) · 18.3 KB
/
figma-export.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
name: 🚀 Release (Figma)
# push:
# paths:
# - ".github/workflows/figma-export.yml"
on:
workflow_dispatch:
inputs:
brand:
type: choice
description: Library to export
required: true
default: "all"
options:
- all
- telefonica
- o2
- blau
- vivo
draft:
type: boolean
default: true
description: Draft PR
env:
TELEFONICA_FIGMA_ID: JHuzksh01yxExMeMQBvymq
O2_FIGMA_ID: wHTqJ7KDhGKrNSNpmMb9nW
BLAU_FIGMA_ID: 6TYIfq6EZJl7NcSbbYAo79
VIVO_FIGMA_ID: IrcHGIgsF5Cq4ZX1LRhuis
MISTICA_ICONS_FILE_URL: https://www.figma.com/file/JHuzksh01yxExMeMQBvymq/M%C3%ADstica-Icons?node-id=0%3A71&t=hqGKHvCEvRHET7YC-0
O2_FILE_URL: https://www.figma.com/file/wHTqJ7KDhGKrNSNpmMb9nW/?node-id=611%3A3298
BLAU_FILE_URL: https://www.figma.com/file/6TYIfq6EZJl7NcSbbYAo79/Blau?node-id=0%3A1
VIVO_FILE_URL: https://www.figma.com/file/IrcHGIgsF5Cq4ZX1LRhuis/Vivo-New-(Beta)?type=design&node-id=2625-199
jobs:
export-all:
if: ${{ github.event.inputs.brand == 'all' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/telefonica/filled|g' figma-export-icons.template.json > telefonica-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/telefonica/regular|g' figma-export-icons.template.json > telefonica-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/telefonica/light|g' figma-export-icons.template.json > telefonica-light.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/o2/filled|g' figma-export-icons.template.json > o2-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/o2/regular|g' figma-export-icons.template.json > o2-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/o2/light|g' figma-export-icons.template.json > o2-light.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/blau/regular|g' figma-export-icons.template.json > blau-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/blau/filled|g' figma-export-icons.template.json > blau-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/vivo-new/filled|g' figma-export-icons.template.json > vivo-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/vivo-new/regular|g' figma-export-icons.template.json > vivo-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/vivo-new/light|g' figma-export-icons.template.json > vivo-light.json
- name: Export icons
run: |
npm run export-telefonica-filled
npm run export-telefonica-regular
npm run export-telefonica-light
npm run export-o2-filled
npm run export-o2-regular
npm run export-o2-light
npm run export-blau-regular
npm run export-blau-filled
npm run export-vivo-filled
npm run export-vivo-regular
npm run export-vivo-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons -r -o icons
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/md-generator.py icons
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update Figma icons"
pr_body: "
New version of icons exported from [Mistica Icons](${{env.MISTICA_ICONS_FILE_URL}}), [O2](${{env.O2_FILE_URL}}), [Blau](${{env.BLAU_FILE_URL}}) & [Vivo](${{env.VIVO_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-telefonica:
if: ${{ github.event.inputs.brand == 'telefonica' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/telefonica/filled|g' figma-export-icons.template.json > telefonica-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/telefonica/regular|g' figma-export-icons.template.json > telefonica-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.TELEFONICA_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/telefonica/light|g' figma-export-icons.template.json > telefonica-light.json
- name: Export icons
run: |
npm run export-telefonica-filled
npm run export-telefonica-regular
npm run export-telefonica-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/telefonica -r -o icons/telefonica
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/telefonica -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/telefonica -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/md-generator.py icons
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update Mística icons"
pr_body: "
New version of icons exported from [Mistica Icons](${{env.MISTICA_ICONS_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-o2:
if: ${{ github.event.inputs.brand == 'o2' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/o2/filled|g' figma-export-icons.template.json > o2-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/o2/regular|g' figma-export-icons.template.json > o2-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.O2_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/o2/light|g' figma-export-icons.template.json > o2-light.json
- name: Export icons
run: |
npm run export-o2-filled
npm run export-o2-regular
npm run export-o2-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/o2 -r -o icons/o2
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/o2 -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/o2 -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/md-generator.py icons
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update O2 icons"
pr_body: "
New version of icons exported from [O2](${{env.O2_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-blau:
if: ${{ github.event.inputs.brand == 'blau' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/blau/regular|g' figma-export-icons.template.json > blau-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.BLAU_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/blau/filled|g' figma-export-icons.template.json > blau-filled.json
- name: Export icons
run: |
npm run export-blau-regular
npm run export-blau-filled
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/blau -r -o icons/blau
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/blau -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/blau -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/md-generator.py icons
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update Blau icons"
pr_body: "
New version of icons exported from [Blau](${{env.BLAU_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
export-vivo:
if: ${{ github.event.inputs.brand == 'vivo' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Get branch name
# uses: rlespinasse/[email protected]
- name: Install packages
run: |
npm install figma-export-icons --save
sudo apt-get install -y librsvg2-bin libimage-exiftool-perl qpdf
- name: Checkout branch or create new one
run: |
git fetch
if git branch -a | grep origin/import-figma-icons; then
git checkout import-figma-icons
else
git checkout -b import-figma-icons
fi
- name: Generate icon config
run: |
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Filled/' -e 's|ICON_PATH|icons/vivo-new/filled|g' figma-export-icons.template.json > vivo-filled.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Regular/' -e 's|ICON_PATH|icons/vivo-new/regular|g' figma-export-icons.template.json > vivo-regular.json
sed -e 's/YOUR_PERSONAL_TOKEN/${{secrets.FIGMA_TOKEN}}/' -e 's/FILE_ID/${{env.VIVO_FIGMA_ID}}/' -e 's/ICON_FRAME/Light/' -e 's|ICON_PATH|icons/vivo-new/light|g' figma-export-icons.template.json > vivo-light.json
- name: Export icons
run: |
npm run export-vivo-filled
npm run export-vivo-regular
npm run export-vivo-light
- name: Install SVGO & convert
run: |
yarn global add svgo
svgo -f icons/vivo-new -r -o icons/vivo-new
- name: Convert to PDF
run: |
sudo apt-get update && sudo apt-get install -y mat2
for i in $(find icons/vivo-new -type f -name "*.svg"); do rsvg-convert -f pdf -o ${i%.*}.pdf $i; done
for i in $(find icons/vivo-new -type f -name "*.pdf"); do echo $i && exiftool -overwrite_original_in_place -all:all= $i > /dev/null 2>&1 && qpdf --replace-input --deterministic-id $i; done # remove PDF metadata
- name: Readme generator
run: sudo python3 .github/md-generator/md-generator.py icons
- name: Commit & Push
run: |
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Figma icons updated"
git push origin import-figma-icons
- name: Create Pull-Request
uses: repo-sync/pull-request@v2
with:
source_branch: import-figma-icons
destination_branch: "production"
pr_title: "Update Vivo icons"
pr_body: "
New version of icons exported from [Vivo](${{env.VIVO_FILE_URL}}) \n
- [ ] [Review readme import-figma-icons](https://github.com/Telefonica/mistica-icons/tree/import-figma-icons)"
pr_draft: ${{ github.event.inputs.draft }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# pr_body: "
# New version of icons exported from [Mistica Icons][mistica-icons] & [O2][o2-icons] n\
# - [ ] [Review readme import-figma-icons][readme] n\
# [mistica-icons]: https://www.figma.com/file/${{env.TELEFONICA_FIGMA_ID}}/Mistica'-Icons?node-id=0%3A71 n\
# [o2-icons]: https://www.figma.com/file/${{env.O2_FIGMA_ID}}/?node-id=611%3A3298 n\
# [readme]: https://github.com/Telefonica/mistica-icons/tree/import-figma-icons"